VariableMirror.type- the right way. If it returns a ClassMirror, you can use ClassMirror.reflectedTypeto get the Type object for the declaration.
VariableMirror.type , , , , TypeMirror, ClassMirror. TypeVariableMirror TypedefMirror. , - TypeMirror dynamic. , . , , dynamic, . , , Object. TypedefMirrors Function. , , , .
:
final _dynamicType = reflectType(dynamic);
Type getDeclaredType(VariableMirror m) {
var t = m.type;
if (t is ClassMirror) return t.reflectedType;
if (t is TypedefMirror) return Function;
if (t == _dynamicType) return Object;
throw new ArgumentError("I don't know how to handle ${t}");
}