I have found a piece of code about Globals in Python that globals()['use_variables_as_function_name']()
is equivalent to use_variaable_as_function_name()
.In fact, is there any codes in Flutter could do the same thing like Python do?
Asked
Active
Viewed 62 times
0

KYflutterrookie
- 47
- 1
-
Flutter apps use the Dart programming language, so you should search for dynamic method calling in Dart. [Here's the first post that came up when I searched it myself](https://stackoverflow.com/questions/13293345/dynamic-class-method-invocation-in-dart) - I'm not literate in Dart, though, so I don't know if this is actually a duplicate – Green Cloak Guy Sep 08 '21 at 03:43
-
There is no automatic way to map `String`s to functions without reflection. You would have to create such a mapping yourself manually. – jamesdlin Sep 08 '21 at 04:37