uploadLogo method

Future<void> uploadLogo(
  1. List<int> logoBytes
)

Updates only the company logo

Implementation

Future<void> uploadLogo(List<int> logoBytes) async {
  if (state.profile == null) return;

  emit(state.copyWith(isLoading: true, error: null));

  final result = await updateCompanyLogo(logoBytes);

  result.fold(
    (failure) => emit(state.copyWith(
      isLoading: false,
      error: failure.message,
    )),
    (_) {
      final updatedProfile = state.profile!.copyWith(
        companyLogoBytes: logoBytes,
      );
      emit(state.copyWith(
        profile: updatedProfile,
        isLoading: false,
        error: null,
      ));
    },
  );
}