deleteMeal method
Deletes an existing meal from either the local database or the API.
meal: TheMealobject representing the meal to be deleted.user: TheUserobject representing the current user.
Returns a Future<bool> indicating whether the meal was successfully deleted.
Implementation
Future<bool> deleteMeal({required Meal meal, required User user}) async {
if (useLocalDb) {
// Delete meal from the local database
return await _mealDatabaseRepo.deleteMeal(meal: meal, userID: user.ID);
} else {
final ApiReturn apiResponse = await _apiConnector.getMealRepo().deleteMeal(meal: meal, user: user);
return apiResponse.success;
}
}