UPDATE: The feature list mentioned in this question varies in length of composition based on a given restaurant. Not every restaurant will have the same features or the same number of features.
I'm creating a list of restaurant of features in my flutter app with a distinct icon for each. These aren't necessarily unique, as there is some repetition based on the feature (e.g. anything with "menu" returns a food icon).
I currently have this set up as a long series of if-then lookups based on the feature (see below). The current system has a fallback icon for the case in which a given feature doesn't have a feature mapped to it. We add features in the backend before updated the app in the app store, so need a way to handle new features that don't have an icon yet.
I am sure there has to be a better way using a map or new class. Thanks for the help!
loadedRestaurant.restFeatureList![index].toString().toLowerCase().contains('family')
? Icons.family_restroom_rounded
: loadedRestaurant.restFeatureList![index].toString().toLowerCase().contains('game day')
? Icons.sports
...
The resulting widget looks like this: Screenshot of restFeatureList