22 lines
639 B
Dart
22 lines
639 B
Dart
import 'package:bloc/bloc.dart';
|
|
import 'package:equatable/equatable.dart';
|
|
import 'package:unit2/model/passo/land_ref.dart';
|
|
import 'package:unit2/sevices/passo/building/landref_services.dart';
|
|
|
|
part 'landref_event.dart';
|
|
part 'landref_state.dart';
|
|
|
|
class LandrefBloc extends Bloc<LandrefEvent, LandrefState> {
|
|
LandrefBloc() : super(LandrefLoading()) {
|
|
on<LoadLandref>((event, emit) async {
|
|
emit(LandrefLoading());
|
|
try {
|
|
final landRef = await LandRefServices.instance.fetch(event.id);
|
|
emit(LandrefLoaded(landRef));
|
|
} catch (e) {
|
|
emit(LandrefErrorState(e.toString()));
|
|
}
|
|
});
|
|
}
|
|
}
|