maybeWhen<R> method

R maybeWhen<R>({
  1. R idle()?,
  2. R uploading(
    1. double progress
    )?,
  3. R processing()?,
  4. R success(
    1. T data
    )?,
  5. R failed(
    1. FailureResponse<E> error
    )?,
  6. R networkError()?,
  7. required R orElse(),
})

Implementation

R maybeWhen<R>({
  R Function()? idle,
  R Function(double progress)? uploading,
  R Function()? processing,
  R Function(T data)? success,
  R Function(FailureResponse<E> error)? failed,
  R Function()? networkError,
  required R Function() orElse,
}) =>
    switch (this) {
      UploadIdleState<T, E>()                       => idle?.call() ?? orElse(),
      UploadingState<T, E>(progress: final p)       => uploading?.call(p) ?? orElse(),
      UploadProcessingState<T, E>()                 => processing?.call() ?? orElse(),
      UploadSuccessState<T, E>(data: final d)       => success?.call(d) ?? orElse(),
      UploadFailedState<T, E>(error: final e)       => failed?.call(e) ?? orElse(),
      UploadNetworkErrorState<T, E>()               => networkError?.call() ?? orElse(),
    };