prepareDeletePlace function
- required MarkerData marker,
- required List<
Place> allPlaces,
Prepares a place for deletion by finding it in the list.
Implementation
DeletePlaceResult prepareDeletePlace({
required MarkerData marker,
required List<Place> allPlaces,
}) {
final index = allPlaces.indexWhere((p) => p.id == marker.id);
if (index == -1) {
return const DeletePlaceResult(success: false);
}
return DeletePlaceResult(
success: true,
removedIndex: index,
removedPlace: allPlaces[index],
);
}