I tried to define a class, which contains a List of a specific item-object, which will be populated within Constructor and will also receive new items at a later time:
class Repository {
final List<Voting> _items = List<Voting>();
Repository() {
_items.add(Voting(1, "xyz", 0));
}
List<Voting> fetchItems() {
return _items;
}
}
However, Flutter is complaining:
The default 'List' constructor isn't available when null safety is enabled.
How to do?