when<R> method

R when<R>({
  1. required R onLoading(
    1. L? loading
    ),
  2. required R onError(
    1. dynamic error
    ),
  3. required R onData(
    1. V data
    ),
})

Implementation

R when<R>(
        {required R Function(L? loading) onLoading,
        required R Function(dynamic error) onError,
        required R Function(V data) onData}) =>
    this.isData
        ? onData((this as _DataBitState).data)
        : (this.isError
            ? onError((this as _ErrorBitState).e)
            : onLoading((this as _LoadingBitState).loading));