basic csv loader, transaction list & half done stats page
This commit is contained in:
24
lib/clients/storage/storage_client.dart
Normal file
24
lib/clients/storage/storage_client.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class StorageClient {
|
||||
save(String filename, String data) async {
|
||||
File file = await _getJson(filename);
|
||||
await file.writeAsString(data);
|
||||
}
|
||||
|
||||
Future<String> load(String filename) async {
|
||||
File file = await _getJson(filename);
|
||||
return file.readAsString();
|
||||
}
|
||||
|
||||
Future<File> _getJson(String filename) async {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final file = File('${dir.path}/$filename');
|
||||
if (!file.existsSync()) {
|
||||
file.createSync();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user