isNullable property
bool
isNullable
Whether this type is nullable.
This is the difference between T?
and T
:
RuntimeType<String>(); // Non-nullable
RuntimeType<String?>(); // Nullable
Note that dynamic
and Null
are nullable despite not having the nullable ?
suffix.
Implementation
bool get isNullable => acceptsInstance(null);