removePlace static method

Future removePlace(
  1. String query,
  2. PlacesModel placeToRemove
)

Removes a place from the list for a specific query.

Implementation

static Future removePlace(String query, PlacesModel placeToRemove) async {
  List<PlacesModel> places = await getPlaces(query);
  places.removeWhere((place) =>
      place.id == placeToRemove.id &&
      place.name == placeToRemove.name &&
      place.description == placeToRemove.description);
  await setPlaces(query, places);
}