runtime_type library
A non-opaque representation of types at runtime.
Normally, Type
objects are opaque and cannot be used for actual logic. RuntimeType
allows for operations such as sub- or super-type checking, type checks, and casting using a variable instead of a literal.
To use, replace your type literals with calls to the RuntimeType
constructor:
// Before
final stringType = String;
// After
final stringType = RuntimeType<String>();
Classes
-
RuntimeType<
T> - A non-opaque representation of a Type that can be used at runtime.
Extensions
-
Function0TypeX1
on R Function<
T0>() - Additional RuntimeType functionality for Functions with 1 type arguments and 0 arguments.
-
Function0TypeX2
on R Function<
T0, T1>() - Additional RuntimeType functionality for Functions with 2 type arguments and 0 arguments.
-
Function0TypeX3
on R Function<
T0, T1, T2>() - Additional RuntimeType functionality for Functions with 3 type arguments and 0 arguments.
-
Function0TypeX4
on R Function<
T0, T1, T2, T3>() - Additional RuntimeType functionality for Functions with 4 type arguments and 0 arguments.
-
Function0TypeX5
on R Function<
T0, T1, T2, T3, T4>() - Additional RuntimeType functionality for Functions with 5 type arguments and 0 arguments.
-
Function1TypeX1
on R Function<
T0>(U0) - Additional RuntimeType functionality for Functions with 1 type arguments and 1 arguments.
-
Function1TypeX2
on R Function<
T0, T1>(U0) - Additional RuntimeType functionality for Functions with 2 type arguments and 1 arguments.
-
Function1TypeX3
on R Function<
T0, T1, T2>(U0) - Additional RuntimeType functionality for Functions with 3 type arguments and 1 arguments.
-
Function1TypeX4
on R Function<
T0, T1, T2, T3>(U0) - Additional RuntimeType functionality for Functions with 4 type arguments and 1 arguments.
-
Function1TypeX5
on R Function<
T0, T1, T2, T3, T4>(U0) - Additional RuntimeType functionality for Functions with 5 type arguments and 1 arguments.
-
Function2TypeX1
on R Function<
T0>(U0, U1) - Additional RuntimeType functionality for Functions with 1 type arguments and 2 arguments.
-
Function2TypeX2
on R Function<
T0, T1>(U0, U1) - Additional RuntimeType functionality for Functions with 2 type arguments and 2 arguments.
-
Function2TypeX3
on R Function<
T0, T1, T2>(U0, U1) - Additional RuntimeType functionality for Functions with 3 type arguments and 2 arguments.
-
Function2TypeX4
on R Function<
T0, T1, T2, T3>(U0, U1) - Additional RuntimeType functionality for Functions with 4 type arguments and 2 arguments.
-
Function2TypeX5
on R Function<
T0, T1, T2, T3, T4>(U0, U1) - Additional RuntimeType functionality for Functions with 5 type arguments and 2 arguments.
- RuntimeTypeX on Object?
- Provides extensions to allow RuntimeTypes appear more similar to the core Dart language.
Constants
-
boolType
→ const RuntimeType<
bool> -
The
bool
type represented as a RuntimeType. -
doubleType
→ const RuntimeType<
double> -
The
double
type represented as a RuntimeType. - dynamicType → const RuntimeType
-
The
dynamic
type, represented as a RuntimeType. -
enumType
→ const RuntimeType<
Enum> -
The
enum
type, represented as a RuntimeType. -
intType
→ const RuntimeType<
int> -
The
int
type, represented as a RuntimeType. -
neverType
→ const RuntimeType<
Never> -
The
Never
type, represented as a RuntimeType. -
nullType
→ const RuntimeType<
Null> -
The
Null
type, represented as a RuntimeType. -
numType
→ const RuntimeType<
num> -
The
num
type, represented as a RuntimeType. -
objectType
→ const RuntimeType<
Object> -
The
Object
type, represented as a RuntimeType. -
stringType
→ const RuntimeType<
String> -
The
String
type, represented as a RuntimeType.