So I have a list of teams, each team has a different icon. I'm saving the icons as String in Firebase because my idea was to do this: For example for team blue; instead of using Icons.blue I would use MyCustomIcons.myBlue whereas myBlue is a String I read from the database. How can I get this to work with the dot operator?
I don't know how else I would dynamicaly use different icons for each team.
Sorry if this is stupid. I'm very new to programming.
Some code:
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(left: 10.0, right: 10.0),
child: Text(
teams[teamsCounter].name,
style: widget.teamNameTextStyle,
textAlign: TextAlign.center,
),
),
Icon(
Icons.gamepad, // this way this is static for all teams.
// what I would like to do is something like: MyCustomIcons.widget.teams[teamsCounter].icon,
size: widget.iconSize,
color: widget.iconColor,
),
],
),