From 2eb7ba42707984917f74915da6b5e5ad82583627 Mon Sep 17 00:00:00 2001 From: Rodrigo Pina Date: Mon, 4 Nov 2024 02:21:11 +0000 Subject: [PATCH] Update app_restaurant_database.dart --- .../local_storage/database/app_restaurant_database.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart b/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart index 96c412230..1a3b8428f 100644 --- a/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart +++ b/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart @@ -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'; @@ -66,9 +65,8 @@ class RestaurantDatabase extends AppDatabase> { final List> restaurantsFromDB = await txn.query('RESTAURANTS'); for (final restaurantMap in restaurantsFromDB) { - final mealsJson = restaurantMap['meals'] as String; - final mealsList = jsonDecode(mealsJson) as List; - final meals = mealsList.map((mealData) => Meal.fromJson(mealData as Map)).toList(); + final id = restaurantMap['id'] as int; + final meals = await getRestaurantMeals(txn, id); final restaurant = Restaurant.fromMap(restaurantMap, meals); restaurants.add(restaurant);