dart:mirrors reflectType() not returning TypedefMirror

43 Views Asked by At

I am running the following dart code:

import 'dart:mirrors';

typedef Func();

void main() {
  final m = reflectType(Func);
  print(m);
}

I would expect m to be a reference to TypedefMirror but instead the output is:

FunctionTypeMirror on '() -> dynamic'

Which is not in line with some test cases that I found on GitHub. I wonder what am I missing? Is there a way to retrieve the name of the original typedef using dart:mirrors?

> dart --version
Dart SDK version: 2.19.2 (stable) (Tue Feb 7 18:37:17 2023 +0000) on "windows_x64"
0

There are 0 best solutions below