getStreamed<T> method

  1. @override
Stream<Result<T>> getStreamed<T>(
  1. String path, {
  2. Map<String, dynamic>? queryParameters,
  3. FutureOr<T> onSuccess(
    1. dynamic data
    )?,
  4. FutureOr<T> onError(
    1. dynamic data
    )?,
  5. RestApiClientRequestOptions? options,
})
override

Implementation

@override
Stream<Result<T>> getStreamed<T>(
  String path, {
  Map<String, dynamic>? queryParameters,
  FutureOr<T> Function(dynamic data)? onSuccess,
  FutureOr<T> Function(dynamic data)? onError,
  RestApiClientRequestOptions? options,
}) async* {
  if (_options.cacheEnabled) {
    final cachedResult = await getCached(
      path,
      queryParameters: queryParameters,
      onSuccess: onSuccess,
    );

    if (cachedResult.hasData) {
      yield cachedResult;
    }
  }

  yield await get(
    path,
    queryParameters: queryParameters,
    onSuccess: onSuccess,
    options: options,
  );
}