Future<void> onRequest( RequestOptions options, RequestInterceptorHandler handler, ) async { final online = await checkInternetUsecase(); if (!online) { var dataCached = await cacheAdapter.get(options.path); // Se não passou de 5 minutos, retorna o cache handler.resolve( Response( data: json.encode(dataCached?.data), extra: options.extra, statusCode: 200, requestOptions: options, ), true, ); return; } handler.next(options); }