getCached<T> method

  1. @override
Future<Result<T>> getCached<T>(
  1. String path, {
  2. Map<String, dynamic>? queryParameters,
  3. FutureOr<T> onSuccess(
    1. dynamic data
    )?,
  4. FutureOr<T> onError(
    1. dynamic data
    )?,
})
override

Implementation

@override
Future<Result<T>> getCached<T>(
  String path, {
  Map<String, dynamic>? queryParameters,
  FutureOr<T> Function(dynamic data)? onSuccess,
  FutureOr<T> Function(dynamic data)? onError,
}) async {
  final requestOptions = RequestOptions(
    path: path,
    queryParameters: queryParameters,
    headers: _dio.options.headers,
  );

  return CacheResult(
    data: await _resolveResult(
      (await cacheHandler.get(requestOptions)),
      onSuccess,
    ),
  );
}