firstOrDefault method

E firstOrDefault(
  1. E defaultValue
)

Returns the first element or defaultValue when null or empty.

Implementation

E firstOrDefault(E defaultValue) =>
    isNotEmptyOrNull ? this!.first : defaultValue;