Viewing version 2.1.4. Open the latest package page.

path_provider

2.1.4

Flutter plugin for getting commonly used locations on host platform file systems, such as the temp and app data directories.

Download archive

Readme

path_provider

pub package

A Flutter plugin for finding commonly used locations on the filesystem. Supports Android, iOS, Linux, macOS and Windows. Not all methods are supported on all platforms.

Android iOS Linux macOS Windows
Support SDK 16+ 12.0+ Any 10.14+ Windows 10+

Example

final Directory tempDir = await getTemporaryDirectory();

final Directory appDocumentsDir = await getApplicationDocumentsDirectory();

final Directory? downloadsDir = await getDownloadsDirectory();

Supported platforms and paths

Directories support by platform:

Directory Android iOS Linux macOS Windows
Temporary ✔️ ✔️ ✔️ ✔️ ✔️
Application Support ✔️ ✔️ ✔️ ✔️ ✔️
Application Library ❌️ ✔️ ❌️ ✔️ ❌️
Application Documents ✔️ ✔️ ✔️ ✔️ ✔️
Application Cache ✔️ ✔️ ✔️ ✔️ ✔️
External Storage ✔️ ❌ ❌ ❌️ ❌️
External Cache Directories ✔️ ❌ ❌ ❌️ ❌️
External Storage Directories ✔️ ❌ ❌ ❌️ ❌️
Downloads ✔️ ✔️ ✔️ ✔️ ✔️

Testing

path_provider now uses a PlatformInterface, meaning that not all platforms share a single PlatformChannel-based implementation. With that change, tests should be updated to mock PathProviderPlatform rather than PlatformChannel.

See this path_provider test for an example.

Changelog

2.1.4

  • Updates minimum required path_provider_android to 2.2.0 to ensure support for getDownloadsDirectory() on Android.
  • Updates supported platforms and paths matrix to indicate that downloads are supported on Android.
  • Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.

2.1.3

  • Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
  • Updates support matrix in README to indicate that iOS 11 is no longer supported.
  • Clients on versions of Flutter that still support iOS 11 can continue to use this package with iOS 11, but will not receive any further updates to the iOS implementation.
  • Updates minimum iOS implementation version to include a privacy manifest.

2.1.2

  • Updates minimum required plugin_platform_interface version to 2.1.7.
  • Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.

2.1.1

  • Adds pub topics to package metadata.
  • Updates minimum supported SDK version to Flutter 3.7/Dart 2.19.

2.1.0

  • Adds getApplicationCachePath() for storing app-specific cache files.
  • Updates minimum supported macOS version to 10.14.
  • Updates minimum supported SDK version to Flutter 3.3/Dart 2.18.

2.0.15

  • Updates iOS minimum version in README.

2.0.14

  • Updates README to use code excerpts.
  • Aligns Dart and Flutter SDK constraints.

2.0.13

  • Updates links for the merge of flutter/plugins into flutter/packages.
  • Updates minimum Flutter version to 3.0.

2.0.12

  • Switches to the new path_provider_foundation implementation package for iOS and macOS.
  • Updates code for no_leading_underscores_for_local_identifiers lint.
  • Updates minimum Flutter version to 2.10.
  • Fixes avoid_redundant_argument_values lint warnings and minor typos.

2.0.11

  • Updates references to the obsolete master branch.
  • Fixes integration test permission issue on recent versions of macOS.

2.0.10

  • Removes unnecessary imports.
  • Adds OS version support information to README.
  • Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings.

2.0.9

  • Updates documentation on README.md.
  • Updates example application.

2.0.8

  • Updates example app Android compileSdkVersion to 31.
  • Removes obsolete manual registration of Windows and Linux implementations.

2.0.7

  • Moved Android and iOS implementations to federated packages.

2.0.6

  • Added support for Background Platform Channels on Android when it is available.

2.0.5

  • Update minimum Flutter SDK to 2.5 and iOS deployment target to 9.0.

2.0.4

  • Updated Android lint settings.
  • Specify Java 8 for Android build.

2.0.3

  • Add iOS unit test target.
  • Remove references to the Android V1 embedding.

2.0.2

  • Migrate maven repository from jcenter to mavenCentral.

2.0.1

  • Update platform_plugin_interface version requirement.

2.0.0

  • Migrate to null safety.
  • BREAKING CHANGE: Path accessors that return non-nullable results will throw a MissingPlatformDirectoryException if the platform implementation is unable to get the corresponding directory (except on platforms where the method is explicitly unsupported, where they will continue to throw UnsupportedError).

1.6.28

  • Drop unused UUID dependency for tests.

1.6.27

  • Update the example app: remove the deprecated RaisedButton and FlatButton widgets.

1.6.26

  • Fix outdated links across a number of markdown files (#3276)

1.6.25

  • Update Flutter SDK constraint.

1.6.24

  • Remove unused test dependency.
  • Update Dart SDK constraint in example.

1.6.23

  • Check in windows/ directory for example/

1.6.22

  • Switch to guava-android dependency instead of full guava.

1.6.21

  • Update android compileSdkVersion to 29.

1.6.20

  • Check in linux/ directory for example/

1.6.19

  • Android implementation does path queries in the background thread rather than UI thread.

1.6.18

  • Keep handling deprecated Android v1 classes for backward compatibility.

1.6.17

  • Update Windows endorsement verison again, to pick up the fix for web compilation in projects that include path_provider.

1.6.16

  • Update Windows endorsement verison

1.6.15

  • Endorse Windows implementation.
  • Remove the need to call disablePathProviderPlatformOverride in tests

1.6.14

  • Update package:e2e -> package:integration_test

1.6.13

  • Update package:e2e reference to use the local version in the flutter/plugins repository.

1.6.12

  • Fixed a Java lint in a test.

1.6.11

  • Updated documentation to reflect the need for changes in testing for federated plugins

1.6.10

  • Linux implementation endorsement

1.6.9

  • Post-v2 Android embedding cleanups.

1.6.8

  • Update lower bound of dart dependency to 2.1.0.

1.6.7

  • Remove Android dependencies fallback.
  • Require Flutter SDK 1.12.13+hotfix.5 or greater.
  • Fix CocoaPods podspec lint warnings.

1.6.6

  • Replace deprecated getFlutterEngine call on Android.

1.6.5

  • Remove unused class name in pubspec.

1.6.4

  • Endorsed macOS implementation.

1.6.3

  • Use path_provider_platform_interface in core plugin.

1.6.2

  • Move package contents into path_provider for platform federation.

1.6.1

  • Make the pedantic dev_dependency explicit.

1.6.0

  • Support for retrieving the downloads directory was added. The call for this is getDownloadsDirectory.

1.5.1

  • Remove the deprecated author: field from pubspec.yaml
  • Migrate the plugin to the pubspec platforms manifest.
  • Require Flutter SDK 1.10.0 or greater.

1.5.0

  • Add macOS support.

1.4.5

  • Add support for v2 plugins APIs.

1.4.4

  • Update driver tests in the example app to e2e tests.

1.4.3

  • Update driver tests in the example app to e2e tests.
  • Add missing DartDocs and a lint to prevent further regressions.

1.4.2

  • Update and migrate iOS example project by removing flutter_assets, change "English" to "en", remove extraneous xcconfigs, update to Xcode 11 build settings, remove ARCHS, and build pods as libraries instead of frameworks.

1.4.1

  • Remove AndroidX warnings.

1.4.0

  • Support retrieving storage paths on Android devices with multiple external storage options. This adds a new class AndroidEnvironment that shadows the directory names from Androids android.os.Environment class.
  • Fixes getLibraryDirectory semantics & tests.

1.3.1

  • Define clang module for iOS.

1.3.0

  • Added iOS-only support for getLibraryDirectory.
  • Update integration tests and example test.
  • Update example app UI to use a ListView show the list of content.
  • Update .gitignore to include Xcode build output folder **/DerivedData/

1.2.2

  • Correct the integration test for Android's getApplicationSupportDirectory call.
  • Introduce setMockPathProviderPlatform for API for tests.
  • Adds missing unit and integration tests.

1.2.1

  • Fix fall through bug.

1.2.0

  • On Android, getApplicationSupportDirectory is now supported using getFilesDir.
  • getExternalStorageDirectory now returns null instead of throwing an exception if no external files directory is available.

1.1.2

  • getExternalStorageDirectory now uses getExternalFilesDir on Android.

1.1.1

  • Cast error codes as longs in iOS error strings to ensure compatibility between arm32 and arm64.

1.1.0

  • Added getApplicationSupportDirectory.
  • Updated documentation for getApplicationDocumentsDirectory to suggest using getApplicationSupportDirectory on iOS and getExternalStorageDirectory on Android.
  • Updated documentation for getTemporaryDirectory to suggest using it for caches of files that do not need to be backed up.
  • Updated integration tests and example to reflect the above changes.

1.0.0

  • Added integration tests.

0.5.0+1

  • Log a more detailed warning at build time about the previous AndroidX migration.

0.5.0

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.4.1

  • Updated Gradle tooling to match Android Studio 3.1.2.

0.4.0

  • Breaking change. Set SDK constraints to match the Flutter beta release.

0.3.1

  • Simplified and upgraded Android project template to Android SDK 27.
  • Updated package description.

0.3.0

  • Breaking change. Upgraded to Gradle 4.1 and Android Studio Gradle plugin 3.0.1. Older Flutter projects need to upgrade their Gradle setup as well in order to use this version of the plugin. Instructions can be found here.

0.2.2

  • Add FLT prefix to iOS types

0.2.1+1

  • Updated README

0.2.1

  • Add function to determine external storage directory.

0.2.0

0.1.3

  • Upgrade Android SDK Build Tools to 25.0.3.

0.1.2

  • Add test.

0.1.1

  • Change to README.md.

0.1.0

  • Initial Open Source release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'path_provider:2.1.4'
pubspec.yaml
name: path_provider
description: Flutter plugin for getting commonly used locations on host platform file systems, such as the temp and app data directories.
repository: https://github.com/flutter/packages/tree/main/packages/path_provider/path_provider
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
version: 2.1.4

environment:
  sdk: ^3.2.0
  flutter: ">=3.16.0"

flutter:
  plugin:
    platforms:
      android:
        default_package: path_provider_android
      ios:
        default_package: path_provider_foundation
      linux:
        default_package: path_provider_linux
      macos:
        default_package: path_provider_foundation
      windows:
        default_package: path_provider_windows

dependencies:
  flutter:
    sdk: flutter
  path_provider_android: ^2.2.0
  path_provider_foundation: ^2.3.2
  path_provider_linux: ^2.2.0
  path_provider_platform_interface: ^2.1.0
  path_provider_windows: ^2.2.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  integration_test:
    sdk: flutter
  plugin_platform_interface: ^2.1.7
  test: ^1.16.0

topics:
  - files
  - path-provider
  - paths

Version history

VersionPublishedArchiveSHA-256
0.1.0Cached · Upstream SHA-256 matchedDownloada6dd5ca3…371e4f
0.1.1Cached · Upstream SHA-256 matchedDownload6e9d01a6…d56be8
0.1.2Cached · Upstream SHA-256 matchedDownloadb5639d4e…416582
0.1.3Cached · Upstream SHA-256 matchedDownloade72e51b1…d443f9
0.2.0Cached · Upstream SHA-256 matchedDownload47354984…847777
0.2.1+1Cached · Upstream SHA-256 matchedDownloade442ada1…472931
0.2.2Cached · Upstream SHA-256 matchedDownload744b92f4…466d49
0.3.0Cached · Upstream SHA-256 matchedDownload92364071…6ce731
0.3.1Cached · Upstream SHA-256 matchedDownloadfe8250b5…c651ee
0.4.0Cached · Upstream SHA-256 matchedDownload7abb12c0…1b8701
0.4.1Cached · Upstream SHA-256 matchedDownloadb1938bf0…0c0edb
0.5.0Cached · Upstream SHA-256 matchedDownload63c1a6da…87ab0d
0.5.0+1Cached · Upstream SHA-256 matchedDownloadc100f370…40aa81
1.0.0Cached · Upstream SHA-256 matchedDownload8c0ff4b1…f4e300
1.1.0Cached · Upstream SHA-256 matchedDownload651ba333…bc960e
1.1.2Cached · Upstream SHA-256 matchedDownload22ddd638…51ea11
1.2.0Cached · Upstream SHA-256 matchedDownload2dc54a64…155580
1.2.2Cached · Upstream SHA-256 matchedDownloade5146d39…67a8e9
1.3.0Cached · Upstream SHA-256 matchedDownload94c743f4…6db59d
1.3.1Cached · Upstream SHA-256 matchedDownload6ace780d…b7709b
1.4.0Cached · Upstream SHA-256 matchedDownload267c49ff…affce0
1.4.2Cached · Upstream SHA-256 matchedDownload29aae7fd…9b07fe
1.4.4Cached · Upstream SHA-256 matchedDownloadd760ed42…bec34b
1.4.5Cached · Upstream SHA-256 matchedDownload7e75d8ed…ed2b06
1.5.0Cached · Upstream SHA-256 matchedDownload088c9b67…3350dd
1.5.1Cached · Upstream SHA-256 matchedDownloadcb68b302…6b9eae
1.6.0Cached · Upstream SHA-256 matchedDownloadc6cf9a11…6c952b
1.6.1Cached · Upstream SHA-256 matchedDownload7f141b48…ef8766
1.6.4Cached · Upstream SHA-256 matchedDownload11628c3b…5a4103
1.6.5Cached · Upstream SHA-256 matchedDownloadb2cf36ac…221380
1.6.7Cached · Upstream SHA-256 matchedDownloadb0715a1d…3e3dd9
1.6.8Cached · Upstream SHA-256 matchedDownloadbd491304…cc7d41
1.6.9Cached · Upstream SHA-256 matchedDownload2587a4ee…1f0c37
1.6.10Cached · Upstream SHA-256 matchedDownload6536e4b0…c17edf
1.6.11Cached · Upstream SHA-256 matchedDownloadd5aeaf96…d48064
1.6.14Cached · Upstream SHA-256 matchedDownload7b830373…569ea4
1.6.16Cached · Upstream SHA-256 matchedDownload965977f5…f4f436
1.6.17Cached · Upstream SHA-256 matchedDownload5d718047…027ba4
1.6.18Cached · Upstream SHA-256 matchedDownload1a1ff1f7…688b86
1.6.21Cached · Upstream SHA-256 matchedDownload181aa64f…fb0a32
1.6.22Cached · Upstream SHA-256 matchedDownload447c78b0…681b93
1.6.24Cached · Upstream SHA-256 matchedDownload12b6834c…bdb86f
1.6.27Cached · Upstream SHA-256 matchedDownloada7e09f3a…22897b
1.6.28Cached · Upstream SHA-256 matchedDownload90ea9260…40fa85
2.0.0-nullsafetyCached · Upstream SHA-256 matchedDownloadca4af531…2089b4
2.0.0-nullsafety.1Cached · Upstream SHA-256 matchedDownload4cf0f280…f29693
2.0.0Cached · Upstream SHA-256 matchedDownload5e9a353e…a62a50
2.0.1Cached · Upstream SHA-256 matchedDownloadaa1b3572…3edfe4
2.0.2Cached · Upstream SHA-256 matchedDownloadcfdc261c…f3605d
2.0.3Cached · Upstream SHA-256 matchedDownload101e7244…578bba
2.0.4Cached · Upstream SHA-256 matchedDownload7a692915…7b491e
2.0.5Cached · Upstream SHA-256 matchedDownloadb6db8bde…31b6b0
2.0.6Cached · Upstream SHA-256 matchedDownload47a60af9…b13d2d
2.0.7Cached · Upstream SHA-256 matchedDownloaddf05e975…1017f3
2.0.8Cached · Upstream SHA-256 matchedDownloaddb1cf6c3…80dfc6
2.0.9Cached · Upstream SHA-256 matchedDownloade92dee4d…797568
2.0.10Cached · Upstream SHA-256 matchedDownload3f6e0d69…30ea37
2.0.11Cached · Upstream SHA-256 matchedDownload050e8e85…d372dd
2.0.12Cached · Upstream SHA-256 matchedDownloaddcea5feb…ddec95
2.0.13Cached · Upstream SHA-256 matchedDownload04890b99…d2b6f9
2.0.14Cached · Upstream SHA-256 matchedDownloadc7edf822…e6aad4
2.0.15Cached · Upstream SHA-256 matchedDownload30878137…0acaa2
2.1.0Cached · Upstream SHA-256 matchedDownload909b8483…6467a0
2.1.1Cached · Upstream SHA-256 matchedDownloada1aa8aaa…208aaa
2.1.2Cached · Upstream SHA-256 matchedDownloadb2721793…aa078b
2.1.3Cached · Upstream SHA-256 matchedDownloadc9e7d3a4…8bb161
2.1.4Cached · Upstream SHA-256 matchedDownloadfec0d612…1bf378
2.1.5Cached · Upstream SHA-256 matchedDownload50c5dd5b…55bbcd
2.1.6Cached · Upstream SHA-256 matchedDownloada7f4874f…884825

Dependencies

flutter { "sdk": "flutter" }

path_provider_android "^2.2.0"

path_provider_foundation "^2.3.2"

path_provider_linux "^2.2.0"

path_provider_platform_interface "^2.1.0"

path_provider_windows "^2.2.0"