How to get a property by this name in String?

Posted by Pinki | Updated on

Want to get a property by this name in String? Unfortunately, you cannot use reflection/mirrors in flutter. What you can do, which is tedious, is use maps.

It’s probably better to build the map in the constructor, but if you want const constructors then you’ll have to settle for this. Likely won’t make much of a difference unless you have a million parameters anyway. Then you use it like so:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers