Dart file could not be created

Viewed 31
  Future<void> _createFileRecursively(String fileName) async {
// Create a new directory, recursively creating non-existent directories.
String? directory = await _getDirectoryPath();
await File(directory + "/" + fileName + ".wfdb").create();
// file.createSync(recursive: true);
}


Future<bool> createNewFile(String fileName) async {
    String directory = await _getDirectoryPath();
    File file = File(directory + "/" + fileName + ".wfdb");
    _createFileRecursively(fileName).then((value) async {
      File file = File(directory + "/" + fileName + ".wfdb");
      String password = getRandomString(26);
      String iv = getRandomString(16);
      await writeFileContent(
          fileName,
          EncodingDecodingService.walfJsonEncode({}, password, iv),
          password,
          iv);
      print(await file.exists());
    });

I am using the above code to create files on an android device with dart language, but I cannot output the file. WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permissions have been taken, except that I have made permission requests with the permission handler package. Please help me

0 Answers
Related