Typed<T extends Object> constructor

const Typed<T extends Object>({
  1. String? on,
})

A shorthand constructor for a type with concrete type arguments.

This is the simplest way to define generic type arguments. Note that as long as all of the type arguments are concrete, nested type parameters can be specified indefinitely, directly within T.

@Component(...)
class GenericComponent<A, B> {}

@Component(
  ...
  directives: [
    GenericComponent,
  ],
  directiveTypes: [
    Typed<GenericComponent<String, List<int>>>(),
  ],
)
class ExampleComponent {}

See on for details about this optional parameter.

Implementation

const Typed({
  this.on,
}) :
      // This actually needs to be null, the compiler checks if typeArguments
      // is non-null to determine which constructor was used.
      typeArguments = null;