mercredi 21 juin 2023

Unable to retrieve typeArguments for reflected generic in Dart

I'm trying to get real types passed into generic, but I always get empty collection.

So far, to me it is mandatory to use dart:mirrors.

In future though I'm planning to migrate to reflectable.

Please hint me, where I'm wrong?

import 'dart:mirrors'

class A<T> {}

void main() {
  print(
    reflectClass(A<int>).typeArguments
  );
}

Output:

[]

Exited.




Aucun commentaire:

Enregistrer un commentaire