jeudi 7 février 2019

Getting value of public static field/property of a class by it's name as string in dart via reflection

Say I have a class:

class Icons {
       static const IconData threesixty = IconData(0xe577, fontFamily: 'MaterialIcons');
 }

now I have a string variable with value of "threesixty":

String fieldName = "threesixty";

how can I get the value of the threesixty in Icons class by the fieldName variable?





Aucun commentaire:

Enregistrer un commentaire