swapType<R extends Object> method

  1. @internal
  2. @optionalTypeArgs
StoreResponse<R> swapType<R extends Object>()

Implementation

@internal
@optionalTypeArgs
StoreResponse<R> swapType<R extends Object>() {
  if (this is ErrorStoreResponse) {
    return this as StoreResponse<R>;
  } else if (this is LoadingStoreResponse) {
    return this as StoreResponse<R>;
  } else if (this is NoNewDataStoreResponse) {
    return this as StoreResponse<R>;
  } else if (this is DataStoreResponse) {
    throw Exception('cannot swap type for DataStoreResponse');
  } else {
    throw StateError('');
  }
}