import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:location/location.dart'; import 'package:unit2/sevices/sos/sos_service.dart'; part 'sos_event.dart'; part 'sos_state.dart'; class SosBloc extends Bloc { SosBloc() : super(SosInitial()) { LocationData? locationData; on((event, emit)async { emit(LoadingState()); LocationData? newLocationData = await SosService.instance.getUserLocation(); locationData = newLocationData; // User location Loaded and there is no mobile numbers in cache emit(UserLocationLoaded(locationData: locationData!)); }); } }