Skip to content

Commit 2a79666

Browse files
committed
Format
1 parent d31e033 commit 2a79666

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

flutter_cache_manager/lib/src/cache_manager.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ class CacheManager implements BaseCacheManager {
155155
streamController.addError(e);
156156
}
157157

158-
if (cacheFile != null && e is HttpExceptionWithStatus && e.statusCode == 404) {
158+
if (cacheFile != null &&
159+
e is HttpExceptionWithStatus &&
160+
e.statusCode == 404) {
159161
if (streamController.hasListener) {
160162
streamController.addError(e);
161163
}

flutter_cache_manager/test/cache_manager_test.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ void main() {
216216
verify(webHelper.downloadFile(any, key: anyNamed('key'))).called(1);
217217
});
218218

219-
test('Outdated cacheFile should call to web, where 404 response should add Error to Stream and evict cache',
219+
test(
220+
'Outdated cacheFile should call to web, where 404 response should add Error to Stream and evict cache',
220221
() async {
221222
var fileName = 'test.jpg';
222223
var fileUrl = 'baseflow.com/test';
@@ -225,13 +226,17 @@ void main() {
225226
var store = MockCacheStore();
226227
var file = await createTestConfig().fileSystem.createFile(fileName);
227228
var cachedInfo = FileInfo(file, FileSource.Cache, validTill, fileUrl);
228-
var cacheObject = CacheObject(fileUrl, relativePath: file.path, validTill: validTill, id: 123);
229+
var cacheObject = CacheObject(fileUrl,
230+
relativePath: file.path, validTill: validTill, id: 123);
229231
when(store.getFile(fileUrl)).thenAnswer((_) => Future.value(cachedInfo));
230-
when(store.retrieveCacheData(fileUrl)).thenAnswer((_) => Future.value(cacheObject));
232+
when(store.retrieveCacheData(fileUrl))
233+
.thenAnswer((_) => Future.value(cacheObject));
231234

232235
var webHelper = MockWebHelper();
233-
var error = HttpExceptionWithStatus(404, 'Invalid statusCode: 404', uri: Uri.parse(fileUrl));
234-
when(webHelper.downloadFile(fileUrl, key: anyNamed('key'))).thenThrow(error);
236+
var error = HttpExceptionWithStatus(404, 'Invalid statusCode: 404',
237+
uri: Uri.parse(fileUrl));
238+
when(webHelper.downloadFile(fileUrl, key: anyNamed('key')))
239+
.thenThrow(error);
235240

236241
var cacheManager = TestCacheManager(
237242
createTestConfig(),
@@ -241,7 +246,8 @@ void main() {
241246

242247
// ignore: deprecated_member_use_from_same_package
243248
var fileStream = cacheManager.getFile(fileUrl);
244-
await expectLater(fileStream, emitsInOrder([cachedInfo, emitsError(error)]));
249+
await expectLater(
250+
fileStream, emitsInOrder([cachedInfo, emitsError(error)]));
245251
verify(webHelper.downloadFile(any, key: anyNamed('key'))).called(1);
246252
verify(store.removeCachedFile(cacheObject)).called(1);
247253
});

0 commit comments

Comments
 (0)