Answers for "flutter write to a file"

0

dart write to file

main() async {
  List letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"];
  File file = new File("Letters.txt");
  for (int i = 0; i < 10; i++) {
    await file.writeAsString("${letters[i]}", mode: FileMode.append);
  }
}
Posted by: Guest on November-12-2021
0

write and read to file in flutter

Future<File> get _localFile async {
  final path = await _localPath;
  return File('$path/counter.txt');
}
Posted by: Guest on January-10-2021
0

write and read to file in flutter

Future<String> get _localPath async {
  final directory = await getApplicationDocumentsDirectory();

  return directory.path;
}
Posted by: Guest on January-10-2021
0

write and read to file in flutter

Future<File> writeCounter(int counter) async {
  final file = await _localFile;

  // Write the file.
  return file.writeAsString('$counter');
}
Posted by: Guest on January-10-2021

Browse Popular Code Answers by Language