Skip to content

Commit

Permalink
Update app_restaurant_database.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
R0drig0-P authored Nov 4, 2024
1 parent eb5376d commit 2eb7ba4
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:convert';

import 'package:intl/intl.dart';
import 'package:sqflite/sqflite.dart';
import 'package:uni/controller/local_storage/database/app_database.dart';
Expand Down Expand Up @@ -66,9 +65,8 @@ class RestaurantDatabase extends AppDatabase<List<Restaurant>> {
final List<Map<String, dynamic>> restaurantsFromDB =
await txn.query('RESTAURANTS');
for (final restaurantMap in restaurantsFromDB) {
final mealsJson = restaurantMap['meals'] as String;
final mealsList = jsonDecode(mealsJson) as List<dynamic>;
final meals = mealsList.map((mealData) => Meal.fromJson(mealData as Map<String, dynamic>)).toList();
final id = restaurantMap['id'] as int;
final meals = await getRestaurantMeals(txn, id);

final restaurant = Restaurant.fromMap(restaurantMap, meals);
restaurants.add(restaurant);
Expand Down

0 comments on commit 2eb7ba4

Please sign in to comment.