I have a list containing BottomNavigationBarItems.
final List<BottomNavigationBarItem> = [...BottomNavigationBarItems...]
Now I want to access the icon size from one of the BottomNavigationBarItems.
final iconSize = items[index].icon.size;
But then I get the error that the getter "size" isn't avaible for the type "Widget".
How can I solve that problem?
CodePudding user response:
The parameter icon
of BottomNavigationBarItem
has the type Widget
.
You have to cast it first as Icon
like this:
final iconSize = (items[index].icon as Icon).size;