reflectType method

  1. @override
TypeMirror reflectType(
  1. Type type
)
inherited

Returns a mirror of the given type type.

In the case where type is a parameterized type, i.e., a generic class which has been applied to a list of actual type arguments, the returned mirror will have no declared type variables, but it has a list of actual type arguments. If a mirror of the generic class as such is needed, it can be obtained from originalDeclaration. That mirror will have no actual type arguments, but it will have declared type variables. Other types than classes are not (yet) supported.

Implementation

@override
TypeMirror reflectType(Type type) {
  TypeMirror? result = data[this]!.typeMirrorForType(type);
  if (result == null || !_hasTypeCapability) {
    throw NoSuchCapabilityError(
        'Reflecting on type `$type` without capability');
  }
  return result;
}