passo_mobile_app/lib/bloc/passo/bulding/location/location_bloc.dart

22 lines
667 B
Dart
Raw Permalink Normal View History

2023-09-01 03:22:48 +00:00
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:unit2/model/passo/bldg_loc.dart';
import 'package:unit2/sevices/passo/building/location_landref_services.dart';
part 'location_event.dart';
part 'location_state.dart';
class LocationBloc extends Bloc<LocationEvent, LocationState> {
LocationBloc() : super(LocationLoading()) {
on<LoadLocation>((event, emit) async {
emit(LocationLoading());
try {
final bldgloc = await LocationLandrefServices.instance.fetch(event.id);
emit(LocationLoaded(bldgloc));
} catch (e) {
emit(LocationErrorState(e.toString()));
}
});
}
}