superclass property

  1. @override
ClassMirrorBase<Object>? get superclass
inherited

A mirror on the superclass on the reflectee.

If this type is Object, the superclass will be null.

Required capabilities: superclass requires a TypeRelationsCapability.

Implementation

@override
ClassMirrorBase? get superclass {
  if (_superclassIndex == noCapabilityIndex) {
    if (!_supportsTypeRelations(_reflector)) {
      throw NoSuchCapabilityError(
        'Attempt to get `superclass` of `$qualifiedName` '
        'without `typeRelationsCapability`',
      );
    }
    throw NoSuchCapabilityError(
      'Requesting mirror on un-marked class, '
      '`superclass` of `$qualifiedName`',
    );
  }
  if (_superclassIndex == null) return null; // Superclass of [Object].
  return _data.typeMirrors[_superclassIndex] as ClassMirrorBase?;
}