NullableListQueries<T> extension

Null-safe list helpers frequently used in collection workflows.

on

Properties

firstOrNull → T?

Available on List<T>, provided by the NullableListQueries extension

Returns null instead of throwing if the list is empty.
no setter
lastOrNull → T?

Available on List<T>, provided by the NullableListQueries extension

Returns null instead of throwing if the list is empty.
no setter

Methods

elementAtOrNull(int index) → T?

Available on List<T>, provided by the NullableListQueries extension

Returns the element at index or null when out of bounds.
firstWhereOrNull(bool test(T element)) → T?

Available on List<T>, provided by the NullableListQueries extension

Returns the first element matching test, or null when not found.
lastWhereOrNull(bool test(T element)) → T?

Available on List<T>, provided by the NullableListQueries extension

Returns the last element matching test, or null when not found.