firstOrCompute method

T firstOrCompute(
  1. T compute()
)

First element, or result of compute if empty.

Implementation

T firstOrCompute(T Function() compute) => isEmpty ? compute() : first;