I have this code:
List<Widget> _elementsHere = _locationsRegister
.map((e) => ShowingLocation(
num: e.num,
name: e.name,
icon: e.icon,
))
.toList();
I have specified List<Widget>, but if I print _elementsHere.runtimeType.toString() in console, I can see List<ShowingLocation>. In fact if I add this code:
_elementsHere.insert(0, Text('hello'));
I receive error that Text isn't a subtype of ShowingLocation, despite it's a Widget.
I want _elementsHere as List<Widget> instead of List<ShowingLocation>.