path_provider
2.1.6, released 5 months ago by flutter.dev
Provides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
What it does
The plugin exposes methods such as getTemporaryDirectory, getApplicationDocumentsDirectory, and getDownloadsDirectory to retrieve platform‑specific paths. It abstracts platform differences behind a unified Dart API.
AI-written summary of version 2.1.6, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read or write files in standard app directories without handling platform‑specific path logic yourself
- You require access to the downloads folder or external storage on Android
Skip it when
- Your app only stores data in a key‑value store or database and doesn't need raw file paths
- You need advanced file‑system features like picking files via UI dialogs
Strengths
- Simple, well‑documented API
- Supports all major desktop and mobile platforms
- Handles platform nuances and null/UnsupportedError cases
Weaknesses
- Only provides directory paths, not file‑picker UI
- Requires native plugin setup for each platform
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
Add the package to pubspec.yaml; the plugin automatically registers native code. No additional permissions beyond platform defaults (e.g., Android storage permissions if accessing external storage).
final dir = await getApplicationDocumentsDirectory();
print('App docs dir: ${dir.path}');Alternatives
Packages that do the same job and could replace path_provider.
Works with
Packages commonly used together with path_provider: ones it builds on, ones built on it, and its own family.
- path_provider_androidpath_provider depends on itAndroid implementation of the path_provider plugin for finding commonly used locations.
- path_provider_windowspath_provider depends on itWindows implementation of the path_provider plugin
- path_provider_foundationpath_provider depends on itiOS/macOS implementation of path_provider using direct FFI calls
- shared_preferences_windowsSame familyWindows platform implementation for shared_preferences
- path_parsingSame familyPure Dart library for parsing SVG path strings and generating Dart path code.
- flutter_cache_managerBuilt on path_providerGeneric cache manager for saving web files and cache info on device storage.
- google_fontsBuilt on path_providerFlutter package to load Google Fonts at runtime or bundle them as assets
- audioplayersBuilt on path_providerA Flutter plugin to play multiple audio files simultaneously