requireData method

T requireData()

Returns the available data or throws error if there is no data.

Implementation

T requireData() => switch (this) {
      StockResponseLoading<T>() =>
        throw StockError('There is no data in loading'),
      StockResponseData<T>(value: final value) => value,
      // ignore: only_throw_errors
      StockResponseError<T>(error: final error) => throw error,
    };