import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:unit2/model/passo/barangay.dart'; import 'package:unit2/sevices/passo/barangay.dart'; part 'barangay_event.dart'; part 'barangay_state.dart'; class BarangayBloc extends Bloc { BarangayBloc() : super(BarangayInitial()) { on((event, emit) async { emit(BarangayLoading()); try { final barangay = await BarangayServices.instance.fetch(event.id); emit(BarangayLoaded(barangay)); } catch (e) { emit(BarangayErrorState(e.toString())); } }); } }