This Flutter application demonstrates the use of the path_provider package to retrieve various directory paths on different platforms.
Plaforms: iOS, Android, macOS, Windows, Linux
- Retrieves and displays directory paths on different platforms (iOS, Android, macOS, Windows, Linux, and web (not supported, shows error))
- Uses the
path_providerpackage to access common directories - Displays the paths in a user-friendly format using Text and SelectableText widgets
The app displays the paths of the following directories:
- Temp Directory
- Documents Directory
- Downloads Directory
- Application Support Directory
- Cache Directory
- External Cache Directories
- External Storage Directories
- Library Directory
The app uses the path_provider package to retrieve the directory paths. The path_provider package provides a platform-agnostic way to access common directories.
The app uses the following functions to retrieve the directory paths:
getTemporaryDirectory(): Retrieves the path of the temporary directorygetApplicationDocumentsDirectory(): Retrieves the path of the documents directorygetDownloadsDirectory(): Retrieves the path of the downloads directorygetApplicationSupportDirectory(): Retrieves the path of the application support directorygetApplicationCacheDirectory(): Retrieves the path of the cache directorygetExternalCacheDirectories(): Retrieves the paths of the external cache directoriesgetExternalStorageDirectories(): Retrieves the paths of the external storage directoriesgetLibraryDirectory(): Retrieves the path of the library directory
The app then displays the retrieved directory paths in a user-friendly format using Text and SelectableText widgets.
To run the app, follow these steps:
-
Clone the repository and navigate to the project directory.
-
Run
flutter pub getto retrieve the dependencies.
-
Run
flutter runto launch the app on a simulator or physical device.
Last tested on Flutter (Channel stable, 3.29.1) with path_provider (2.1.5)
This app is for demonstration purposes only and does not perform any actual file operations.
This code is extended/modified from the path_provider_windows example.
Currently, not supported. Will mostly throw MissingPluginException or Unsupported operation: Platform._operatingSystem





