clearAllPlacesWithFeedback function

Future<bool> clearAllPlacesWithFeedback(
  1. BuildContext context,
  2. int count
)

Clears all places and shows appropriate snackbars.

Implementation

Future<bool> clearAllPlacesWithFeedback(BuildContext context, int count) async {
  SnackBarHelper.showInfo(
    context,
    'Clearing all places...',
    duration: const Duration(seconds: 1),
  );

  final success = await PlacesService.clearAllPlaces(
    context,
    const LocationsPage(),
  );

  if (!context.mounted) return success;

  if (success) {
    SnackBarHelper.showSuccess(context, 'Cleared $count places successfully');
  } else {
    SnackBarHelper.showError(context, 'Failed to clear places');
  }
  return success;
}