17 lines
472 B
Dart
17 lines
472 B
Dart
|
import '../models/food.dart';
|
||
|
|
||
|
List<Food> castDynamicToListFood(List<dynamic> dynamicList) {
|
||
|
List<Food> foodList = [];
|
||
|
for (Food element in dynamicList) {
|
||
|
foodList.add(element);
|
||
|
}
|
||
|
return foodList;
|
||
|
}
|
||
|
|
||
|
Map<String,List<Food>> castDynamicMap(Map<dynamic,dynamic> dynamicMap){
|
||
|
Map<String,List<Food>> foodMap = {};
|
||
|
for(dynamic key in dynamicMap.keys){
|
||
|
foodMap.putIfAbsent(key as String , () => castDynamicToListFood(dynamicMap[key]));
|
||
|
}
|
||
|
return foodMap;
|
||
|
}
|