pickLocation method

Future<void> pickLocation()

Implementation

Future<void> pickLocation() async {
  emit(state.copyWith(isLoading: true));
  final result = await getCurrentLocation(NoParams());
  emit(state.copyWith(isLoading: false));

  result.handleReport(
    successMsg: 'Location Picked Successfully!',
    onSuccess: (location) => emit(state.copyWith(locationEntity: location)),
    onFailed: (msg) => emit(
      state.copyWith(reportMsg: "$msg!\nPlease! Enable GPS permission"),
    ),
    isDisplayFailedMsg: true,
  );
}