Skip to content

Instantly share code, notes, and snippets.

@VB10
Created May 30, 2021 23:05
Show Gist options
  • Save VB10/9873096e05c08a9b6b555f6e7904ff12 to your computer and use it in GitHub Desktop.
Save VB10/9873096e05c08a9b6b555f6e7904ff12 to your computer and use it in GitHub Desktop.
test('Fetch Pdf And Cache', () async {
final response = await manager.downloadFileSimple('http://www.africau.edu/images/default/sample.pdf', null);
final directory = await getApplicationDocumentsDirectory();
await Directory('${directory.path}').create();
await Directory('${directory.path}/vb2').create();
final path = '${directory.path}/vb2/1.pdf';
final file = File(path);
final fileWithData = await file.writeAsBytes(response.data!);
expect(await fileWithData.exists(), true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment