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