updateLocationDetails method

Future<ApiResponse> updateLocationDetails(
  1. EntityLocation location,
  2. String id
)

Implementation

Future<ApiResponse> updateLocationDetails(
    EntityLocation location, String id) async {
  _apiResponse = ApiResponse.loading("Loading");
  notifyListeners();
  try {
    EntityLocation? _location = await _updateLocation(location, id);
    _apiResponse = ApiResponse.completed(_location);
  } on SpinachNotFoundException catch (e) {
    _apiResponse = ApiResponse.error(e.toString());
    // throw e;
  } on SpinachDuplicateEntityException catch (e) {
    _apiResponse = ApiResponse.error(e.toString());
  }
  on SpinachInvalidOperationException catch (e) {
    _apiResponse = ApiResponse.error(e.toString());
  }
  catch (e) {
    _apiResponse = ApiResponse.error(e.toString());
    //  throw e;
  }
  notifyListeners();
  return _apiResponse;
}