|
|
@ -37,7 +37,11 @@ class RequestManager { |
|
|
|
final key = '$clientID-$k'; |
|
|
|
final key = '$clientID-$k'; |
|
|
|
|
|
|
|
|
|
|
|
if (cache != null && await cache!.has(key)) { |
|
|
|
if (cache != null && await cache!.has(key)) { |
|
|
|
yield ResultCached(unwrap(deserialize<R>(json.decode((await cache!.get(key))!))), loading: true); |
|
|
|
try { |
|
|
|
|
|
|
|
yield ResultCached(unwrap(deserialize<R>(json.decode((await cache!.get(key))!))), loading: true); |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
debugPrint(e.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
@ -47,8 +51,12 @@ class RequestManager { |
|
|
|
} on Exception catch (e) { |
|
|
|
} on Exception catch (e) { |
|
|
|
if (cache != null && await cache!.has(key)) { |
|
|
|
if (cache != null && await cache!.has(key)) { |
|
|
|
debugPrint(e.toString()); |
|
|
|
debugPrint(e.toString()); |
|
|
|
yield ResultCached(unwrap(deserialize<R>(json.decode((await cache!.get(key))!))), error: e); |
|
|
|
try { |
|
|
|
return; |
|
|
|
yield ResultCached(unwrap(deserialize<R>(json.decode((await cache!.get(key))!))), loading: true); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
debugPrint(e.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
debugPrint(e.toString()); |
|
|
|
debugPrint(e.toString()); |
|
|
|
yield Result.error(e); |
|
|
|
yield Result.error(e); |
|
|
|