TypePlus extension
Used to deconstruct a generic type.
- on
Properties
-
args
→ List<
Type> -
The type arguments of a generic type
no setter
- base → Type
-
The base type of a generic type, with all type arguments set to dynamic.
no setter
- baseId → String
-
The base id of a type
no setter
- id → String
-
The unique id of a type
no setter
- isNullable → bool
-
Indicates if this type is nullable
no setter
- name → String
-
The name of the type, without any type arguments
no setter
- nonNull → Type
-
Returns the non-nullable version of this type
no setter
Methods
-
implementedBy<
T> ([Type? t]) → bool - Check if a type is implemented by another type
-
implements<
T> ([Type? t]) → bool - Check if a type implements or extends another type e.g. int implements num, List implements Iterable
-
provideTo<
R> (R fn< U>() ) → R - Calls the given function with this type provided as the single type argument
Static Methods
-
add<
T> ({String? id, Iterable< Type> ? superTypes}) → void - Adds a non-generic type, used as a simpler syntax to addFactory
-
addFactory(
Function factory, {String? id, Iterable< Function> ? superTypes}) → void - Adds a type factory for any generic or non-generic type @param id: An optional unique id for this type, that will override the default id
-
fromId(
String id) → Type - Constructs a type from a type id
-
register(
TypeProvider provider) → void - Registers a type provider to be used