Skip to content

Instantly share code, notes, and snippets.

@VB10
Created June 4, 2021 22:06
Show Gist options
  • Save VB10/a5f06b21552f5856b2e2ef86ef89a96f to your computer and use it in GitHub Desktop.
Save VB10/a5f06b21552f5856b2e2ef86ef89a96f to your computer and use it in GitHub Desktop.
test('Cache Model In File', () async {
final model = ItemModel(id: 1345);
final directory = await getApplicationDocumentsDirectory();
await Directory('${directory.path}').create();
await Directory('${directory.path}/vb2').create();
final path = '${directory.path}/vb2/${model.title}.jso';
final file = File(path);
final fileWithData = await file.writeAsString(model.toString());
expect(await fileWithData.exists(), true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment