How to get parameterized instance type with Dart and smoke?
Consider this code:
class Foo { List<String> listOfStrings; }
Using the smoke package , how can I get String
by looking listOfStrings
?
I see what we can get Declaration
from Type
, but I don't see how to get the parameterized type from the Declaration .
This is important in particular for creating a serialization library.
+3
source to share
1 answer
This is not currently possible in smoke.
It might not even be possible to do this with the mirrors API. For example:
import 'dart:mirrors'; class B<T> {} class A { static B<int> b = new B<int>(); } main() { var x = reflectType(A); print(x); print(x.declarations[#b].type); }
will print B
, but not B<int>
.
+2
source to share