Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – FileSystemException: Creation failed, path = ‘Directory: ” (OS Error: Read-only file system, errno = 30)

Posted on November 11, 2022 By

Solution 1 :

Please try changing your path in File function from '$dir/pssswd_export' to dir.path + /pssswd_export'.

Problem :

I am receiving an error as Unhandled Exception: FileSystemException: Creation failed, path = 'Directory: '' (OS Error: Read-only file system, errno = 30) when I am trying to save a xlsx file.

Code:

class ExportPasswords {
  static exportUserEntries(List entries) async {
    final _psd = PasswordDecrypter();
    final _secureStorage = FlutterSecureStorage();

    //creating the xlsx
    var excel = Excel.createExcel();
    var fileBytes = excel.save();

    Sheet sheetObject = excel['pssswd_export'];
    CellStyle cellStyle = CellStyle(
        backgroundColorHex: "#1AFF1A",
        fontFamily: getFontFamily(FontFamily.Calibri));
    cellStyle.underline = Underline.Single;

    for (var entry in entries) {
      final _username = entry['data']['username'];
      final _name = entry['data']['name'];
      final _url = entry['data']['url'];
      final _hashedPassword = entry['data']['password'];
      final _randForKeyToStore = entry['data']['randForKeyToStore'];
      final _randForIV = entry['data']['randForIV'];
      final _masterPassword = await _secureStorage.read(key: 'masterPassword');

      final _decryptedEntryPassword = await _psd.getDecryptedPassword(
          _hashedPassword, _randForKeyToStore, _randForIV, _masterPassword);

      sheetObject.appendRow([_name, _username, _decryptedEntryPassword, _url]);
    }
    PermissionStatus permissionResult =
        await SimplePermissions.requestPermission(
            Permission.WriteExternalStorage);
    if (permissionResult == PermissionStatus.authorized) {
      Directory directory = await getApplicationDocumentsDirectory();
      // print(directory);
      new Directory(directory.path + '/').create(recursive: true).then((dir) {
        print(dir);
        File(join('$dir/pssswd_export'))
          ..createSync(recursive: true)
          ..writeAsBytesSync(fileBytes!);
      });
    }
  }
}

I have given the permission of WRITE_EXTERNAL_STORAGE.

I/SimplePermission( 7685): Requesting permission : android.permission.WRITE_EXTERNAL_STORAGE
I/SimplePermission( 7685): Requesting permission status : 3

In the error it is displayed as Directory : '', but when I am printing the directory value it is showing the path

I/flutter ( 7685): Directory: '/data/user/0/com.palsoham.pssswd.pssswd/app_flutter/'

Comments

Comment posted by stackoverflow.com/questions/51607002/…

Have you checked this:

Comment posted by tr1via

@ShahzadUmarBaig this is what I was referring to. For some reason my code is not working. Am I missing something?

Comment posted by Shahzad Umar Baig

try changing

Comment posted by Shahzad Umar Baig

Adding this as an official answer.

READ  [FIXED] android - square dialog with radius in corners in flutter
Powered by Inline Related Posts
Android Tags:android, android-permissions, dart, flutter

Post navigation

Previous Post: [FIXED] android developer api – there is a ‘Late Initialization Error’ during flutter development
Next Post: [FIXED] android – How to set SSL pinning using retrofit for Firebase Realtime Database Url?

Related Posts

[FIXED] java – findFirstVisibleItemPosition() returns 0 inside nestedScrollView Android
[FIXED] android – Notification similar to whatsapp Android
[FIXED] java – Allow both numeric and text filtering for Android SearchView Android
[FIXED] android – Fragment Container in Jetpack Compose Android
[FIXED] Android: “INSTALL_FAILED_CONFLICTING_PROVIDER” error when adding Facebook SDK Android
[FIXED] java – gson implementation in gradle not working Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can VPN be traced by police?
  • Where were Kaiser-Frazer cars built?
  • How do you make gold rose gold paint?
  • What are the newest type of dentures?
  • Can you wear joggers as dress pants?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme