subtypeOf property

Type? subtypeOf
final

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

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;
...
@Component()
class FooComponent ... {...}

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

then:

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

Implementation

final Type? subtypeOf;