Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
load_profile_cubit_cubit.dart
Go to the documentation of this file.
1import 'package:bloc/bloc.dart';
2import 'package:connect/features/account/domain/entities/profile_entity.dart';
3import 'package:dartz/dartz.dart';
4
5import '../../../../../core/errors/failures.dart';
6import '../../../../../core/services/service_locator.dart';
7import '../../../domain/use_cases/load_profile_usecase.dart';
8import '../../cubit/profile_cubit/load_profile_cubit_cubit.dart';
9
10class LoadProfileCubitCubit extends Cubit<LoadProfileCubitState> {
11 final _loadProfileUseCase = sl<LoadProfileUseCase>();
12 LoadProfileCubitCubit() : super(LoadProfileCubitInitial());
13
14 Future<void> loadProfile({required String userId}) async {
15 emit(LoadingProfileState());
16 final Either<Failure, ProfileEntity> result =
17 await _loadProfileUseCase.call(userId);
18 result.fold(
20 (profile) => emit(ProfileLoadedState(profileInformations: profile)),
21 );
22 }
23}
LoadProfileCubitCubit() Future< void > loadProfile({required String userId}) async
sealed class DocumentState extends Equatable failure
const ProfileLoadingFailureState({required this.failure})
profile
Definition routes.dart:76
final sl