Ryan Gonzalez
2018-06-18 18:45:39 UTC
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.x
Uncaught exception:
C.Type_X_P98.get$x is not a function
Is 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/
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.x
Uncaught exception:
C.Type_X_P98.get$x is not a function
Is 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+***@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.
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+***@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.