The getter 'length' isn't defined for the type 'List<Meals> Function({bool growable})'

Solution 1:

Change toList to toList().

final categoryMeals = DUMMY_MEALS.where((meal) { 
  return meal.categories.contains(categoryId);
   }).toList;