{"id":21206201,"url":"https://github.com/rtmigo/file_errors","last_synced_at":"2026-04-13T06:03:14.958Z","repository":{"id":56828768,"uuid":"350436331","full_name":"rtmigo/file_errors","owner":"rtmigo","description":"Cross-platform extensions that help determine the cause of a caught FileSystemException","archived":false,"fork":false,"pushed_at":"2021-03-29T09:48:37.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T23:11:53.262Z","etag":null,"topics":["android","dart","darwin","directories","enoent","errno","error-codes","errors","exceptions","filesystem","filesystemexception","flutter","ios","linux","macos","os","posix","windows"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/file_errors","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtmigo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-22T17:45:42.000Z","updated_at":"2021-03-29T09:48:39.000Z","dependencies_parsed_at":"2022-08-26T13:51:12.138Z","dependency_job_id":null,"html_url":"https://github.com/rtmigo/file_errors","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rtmigo/file_errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffile_errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffile_errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffile_errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffile_errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtmigo","download_url":"https://codeload.github.com/rtmigo/file_errors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffile_errors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004690,"owners_count":26083750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dart","darwin","directories","enoent","errno","error-codes","errors","exceptions","filesystem","filesystemexception","flutter","ios","linux","macos","os","posix","windows"],"created_at":"2024-11-20T20:54:46.648Z","updated_at":"2025-10-10T16:38:03.028Z","avatar_url":"https://github.com/rtmigo.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Pub Package](https://img.shields.io/pub/v/file_errors.svg)](https://pub.dev/packages/file_errors)\n![Generic badge](https://img.shields.io/badge/status-it_works-ok.svg)\n[![Actions Status](https://github.com/rtmigo/file_errors/workflows/unittest/badge.svg?branch=master)](https://github.com/rtmigo/file_errors/actions)\n![Generic badge](https://img.shields.io/badge/testing_on-Win_|_Mac_|_Linux-blue.svg)\n\n# [file_errors](https://github.com/rtmigo/file_errors)\n\n**Cross-platform** extensions that help determine the **cause** of \na caught `FileSystemException`:\n\n- `FileSystemException.isNoSuchFileOrDirectory`\n- `FileSystemException.isDirectoryNotEmpty`\n\n## isNoSuchFileOrDirectory\n\nOccurs when:\n- Trying to read a non-existent file in an existing directory\n- Trying to read or write a file in a non-existent directory\n- Trying to non-recursively create a file in a non-existent directory\n- Trying to list a non-existent directory\n\n``` dart\n  try {\n    \n    print(File('maybe.txt').readAsStringSync());\n    \n  } on FileSystemException catch (exc) {\n    \n    // using property extension added by the library\n    if (exc.isNoSuchFileOrDirectory) { \n      print('It does not exist!');\n    }\n    else {\n      print('Unknown error: $exc');\n    }\n  }\n```\n\n## isDirectoryNotEmpty\n\nOccurs when you try to non-recursively delete a directory but it contains files.\n\n``` dart\n  try {\n    \n    Directory('/path/to/useless').deleteSync();\n    \n  } on FileSystemException catch (exc) {\n    \n    // using property extension added by the library\n    if (exc.isDirectoryNotEmpty) {\n      print('It is not empty!');\n    }\n    else {\n      print('Unknown error: $exc');\n    }\n  }\n```\n\n# Compatibility \n\nThe extensions were unit-tested on **Linux**, **Windows** and **MacOS**. \nMobile systems such as **Android** and **iOS** have the same kernels \nas their desktop relatives. So their error codes are the same.\n\n# Under the hood\n\nThis library interprets the `OSError.errorCode` values depending on the\ncurrent platform. It's two different error codes for `isNoSuchFileOrDirectory` \nand three different error codes for `isDirectoryNotEmpty`. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Ffile_errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtmigo%2Ffile_errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Ffile_errors/lists"}