2023-05-30 09:38:54 +02:00
|
|
|
import '../models/food.dart';
|
|
|
|
|
2023-05-29 22:04:44 +02:00
|
|
|
List<Food> castDynamicToListFood(dynamic dynamicList) {
|
2023-05-30 09:38:54 +02:00
|
|
|
List<Food> foodList = [];
|
2023-05-29 22:04:44 +02:00
|
|
|
if(dynamicList == null){
|
|
|
|
return foodList;
|
|
|
|
}
|
2023-05-30 09:38:54 +02:00
|
|
|
for (Food element in dynamicList) {
|
|
|
|
foodList.add(element);
|
|
|
|
}
|
|
|
|
return foodList;
|
|
|
|
}
|
|
|
|
|
2023-05-30 14:50:27 +02:00
|
|
|
Map<String,List<Food>> castDynamicMap(dynamic dynamicMap){
|
2023-05-30 09:38:54 +02:00
|
|
|
Map<String,List<Food>> foodMap = {};
|
2023-05-30 14:50:27 +02:00
|
|
|
if(dynamicMap == null){
|
|
|
|
return foodMap;
|
|
|
|
}
|
2023-05-30 09:38:54 +02:00
|
|
|
for(dynamic key in dynamicMap.keys){
|
|
|
|
foodMap.putIfAbsent(key as String , () => castDynamicToListFood(dynamicMap[key]));
|
|
|
|
}
|
|
|
|
return foodMap;
|
2023-05-29 22:04:44 +02:00
|
|
|
}
|