passo_mobile_app/lib/bloc/learningDevelopment/learning_development_bloc.dart

29 lines
1.1 KiB
Dart
Raw Normal View History

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()));
// }
});
}
}