lastOrDefault method

E? lastOrDefault(
  1. E defaultValue
)

Returns the last element or defaultValue when null or empty.

Implementation

E? lastOrDefault(E defaultValue) =>
    isNotEmptyOrNull ? this!.last : defaultValue;