object/nullable_more_extensions library

Extensions

FirstOfTypeExtension on List<Object?>
Searches a heterogeneous list for the first element of a given type.
NullableWhen on T?
Null-aware helpers for any nullable receiver T?: run a side effect, transform, or supply a fallback only when (or unless) the value is null.
ToListOrEmpty on T?
Wraps a nullable value into a list, treating null as empty.
TryCast on T?
Non-throwing runtime cast for a nullable receiver.

Functions

asTypeOr<T>(Object? value, T fallback) → T
Returns value as a T when it is one, otherwise fallback.
isType<T>(Object? value) bool
Returns whether value is an instance of T at runtime.