complete budget page

This commit is contained in:
2024-03-01 22:53:19 +01:00
parent 979fecb60a
commit f86c4cd18b
16 changed files with 547 additions and 164 deletions

View File

@@ -0,0 +1,30 @@
import 'dart:io';
import 'package:path_provider/path_provider.dart';
class JsonStorageClient {
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();
}
delete(String filename) async {
File file = await _getJson(filename);
await file.delete();
}
Future<File> _getJson(String filename) async {
final dir = await getApplicationDocumentsDirectory();
final file = File('${dir.path}/$filename');
if (!file.existsSync()) {
file.createSync();
}
return file;
}
}