TL;DR: try running this in DartPad:class X {static String x = 'this is X.x';}void main() {print(X.x);print((X as dynamic).x);}It will give:this is X.xUncaught exception:C.Type_X_P98.get$x is not a functionIs this a bug or known issue? Is there any way to work around it for the time being?
In my scenario, I'm passing a type like the above to a function, and I need to access a static property on it (the reasons are a bit complicated, but it basically has to do with adding a static property in a builder). Right now, I'm trying something like this:void func(dynamic type) {print(type.x);}func(X);but it's not working, of course...
--Ryan (ライアン)
Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else
https://refi64.com/
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CAO41-mMGmoB70MiUMs0p041z6G1YWuy2rXX8D4k6MZojcFrbmw%40mail.gmail.com.