29 lines
1.1 KiB
Dart
29 lines
1.1 KiB
Dart
import 'package:bloc/bloc.dart';
|
|
import 'package:equatable/equatable.dart';
|
|
import 'package:unit2/sevices/profile/learningDevelopment_service.dart';
|
|
|
|
import '../../model/profile/learning_development.dart';
|
|
|
|
part 'learning_development_event.dart';
|
|
part 'learning_development_state.dart';
|
|
|
|
class LearningDevelopmentBloc
|
|
extends Bloc<LearningDevelopmentEvent, LearningDevelopmentState> {
|
|
LearningDevelopmentBloc() : super(LearningDevelopmentInitial()) {
|
|
List<LearningDevelopement> learningsAndDevelopments;
|
|
on<GetLearningDevelopments>((event, emit) async {
|
|
// try {
|
|
emit(LearningDevelopmentLoadingState());
|
|
List<LearningDevelopement> learnings = await LearningDevelopmentServices
|
|
.instance
|
|
.getLearningDevelopments(event.profileId, event.token);
|
|
learningsAndDevelopments = learnings;
|
|
emit(LearningDevelopmentLoadedState(
|
|
learningsAndDevelopment: learningsAndDevelopments));
|
|
// } catch (e) {
|
|
// emit(LeaningDevelopmentErrorState(message: e.toString()));
|
|
// }
|
|
});
|
|
}
|
|
}
|