Tulis dan Baca untuk File di Flutter
Future<File> get _localFile async {
final path = await _localPath;
return File('$path/counter.txt');
}
Thankful Tapir
Future<File> get _localFile async {
final path = await _localPath;
return File('$path/counter.txt');
}
Future<String> get _localPath async {
final directory = await getApplicationDocumentsDirectory();
return directory.path;
}
Future<File> writeCounter(int counter) async {
final file = await _localFile;
// Write the file.
return file.writeAsString('$counter');
}