singleOrNull property

T? singleOrNull

Checks that this iterable has only one element, and returns that element.

Returns null if there are either no elements or more than one element.

Implementation

T? get singleOrNull => this.singleWhereOrNull((_) => true);