class CatalogModel {
static List<Item> items;
static Item getById(int id) =>
items.firstWhere((element) => element.id == id, orElse: null);
static Item getByPosition(int pos) => items[pos];
}
I'm trying to create the class with a static list 'items', where I'm getting the following error:
The non-nullable variable 'items' must be initialized. Try adding an initializer expression.
What should I do?