firstOrNull property

TValue? firstOrNull

Returns the first element of the iterable if not empty, null otherwise.

Implementation

TValue? get firstOrNull => isNotEmpty ? first : null;