subtypeOf property

  1. @override
Type? subtypeOf
final

The component class of this component's "parent type".

See also: UiFactory.setTypeMeta (via extension UiFactoryTypeMeta), which can be used to provide configuration to function components, which don't have this annotation.

Used to enable inheritance in component type-checking in isComponentOfType.

E.g., if component Bar is a subtype of component Foo:

@Factory()
UiFactory<...> Foo = _$Foo;
...
@Component2()
class FooComponent ... {...}

@Factory()
UiFactory<...> Bar = _$Bar;
...
@Component2(subtypeOf: FooComponent)
class BarComponent ... {...}

then:

isComponentOfType(Bar()(), Bar); // true (due to normal type-checking)
isComponentOfType(Bar()(), Foo); // true (due to parent type-checking)

Implementation

@override
final Type? subtypeOf;