firstOrNull property

T? get firstOrNull

Returns null instead of throwing if the list is empty.

Implementation

T? get firstOrNull => isEmpty ? null : first;