maybeWhen<R> method
R
maybeWhen<R>({
- R idle()?,
- R uploading(
- double progress
- R processing()?,
- R success(
- T data
- R failed(
- FailureResponse<
E> error
- FailureResponse<
- R networkError()?,
- 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(),
};