# path_provider
[![pub package](https://img.shields.io/pub/v/path_provider.svg)](https://pub.dev/packages/path_provider)
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+ | 9.0+ | Any | 10.11+ | Windows 10+ |
## Usage
To use this plugin, add `path_provider` as a [dependency in your pubspec.yaml file](https://flutter.dev/docs/development/platform-integration/platform-channels).
## Example
```dart
Directory tempDir = await getTemporaryDirectory();
String tempPath = tempDir.path;
Directory appDocDir = await getApplicationDocumentsDirectory();
String appDocPath = appDocDir.path;
```
## Supported platforms and paths
Directories support by platform:
| Directory | Android | iOS | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: | :---: | :---: |
| Temporary | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Application Support | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Application Library | ❌️ | ✔️ | ❌️ | ✔️ | ❌️ |
| Application Documents | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| 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](https://github.com/flutter/plugins/blob/main/packages/path_provider/path_provider/test/path_provider_test.dart) for an example.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Flutter的path_provider插件是一个平台无关的工具,它的主要作用是提供一种访问设备的文件系统。例如,它允许获取应用临时目录和文档目录等。 对于获取不同平台的文件路径,Flutter的原生开发支持是必要的,因为Android和iOS的文件路径是不同的。借助path_provider插件,可以解决这部分问题。它支持Android、iOS、Linux、MacOS、Windows等平台。 使用该插件,可以通过调用getTemporaryDirectory()方法来获取临时目录,该目录可以被视为缓存文件夹,系统可以随时清空。而文档目录则是用于存储只能由该应用访问的文件,系统不会清除该目录,只有在删除应用时才会消失。
资源推荐
资源详情
资源评论
收起资源包目录
plugin-platform-interface flutter (314个子文件)
AUTHORS 2KB
AUTHORS 2KB
AUTHORS 2KB
AUTHORS 2KB
AUTHORS 2KB
AUTHORS 2KB
my_application.cc 2KB
my_application.cc 2KB
main.cc 514B
main.cc 514B
generated_plugins.cmake 743B
generated_plugins.cmake 743B
generated_plugins.cmake 739B
generated_plugins.cmake 739B
win32_window.cpp 7KB
win32_window.cpp 7KB
run_loop.cpp 2KB
run_loop.cpp 2KB
flutter_window.cpp 2KB
flutter_window.cpp 2KB
main.cpp 1KB
main.cpp 1KB
utils.cpp 634B
utils.cpp 634B
folders.dart 11KB
main.dart 9KB
path_provider_windows_real.dart 8KB
path_provider.dart 7KB
messages.g.dart 7KB
method_channel_path_provider_test.dart 7KB
path_provider_windows_test.dart 7KB
main.dart 6KB
path_provider_test.dart 6KB
messages_test.g.dart 5KB
path_provider_test.dart 4KB
path_provider_foundation_test.dart 4KB
path_provider_platform_interface.dart 4KB
path_provider_test.dart 4KB
path_provider_android_test.dart 3KB
path_provider_linux.dart 3KB
main.dart 3KB
method_channel_path_provider.dart 3KB
main.dart 3KB
path_provider_android.dart 3KB
main.dart 3KB
path_provider_test.dart 3KB
path_provider_linux_test.dart 3KB
get_application_id_real.dart 2KB
path_provider_test.dart 2KB
path_provider_test.dart 2KB
path_provider_foundation.dart 2KB
enums.dart 2KB
messages.g.dart 2KB
messages_test.g.dart 2KB
get_application_id_test.dart 2KB
path_provider_windows_stub.dart 1KB
messages.dart 1KB
path_provider_foundation_test.mocks.dart 1KB
messages.dart 677B
path_provider_windows.dart 531B
get_application_id.dart 441B
integration_test.dart 274B
integration_test.dart 274B
integration_test.dart 274B
integration_test.dart 274B
integration_test.dart 274B
get_application_id_stub.dart 243B
folders_stub.dart 231B
path_provider_linux.dart 204B
DebugProfile.entitlements 418B
DebugProfile.entitlements 415B
Release.entitlements 310B
Release.entitlements 307B
.gitignore 722B
.gitignore 692B
.gitignore 569B
.gitignore 291B
.gitignore 291B
.gitignore 47B
.gitignore 40B
.gitignore 40B
.gitignore 18B
.gitignore 18B
build.gradle 2KB
build.gradle 2KB
build.gradle 1KB
build.gradle 480B
build.gradle 480B
settings.gradle 479B
settings.gradle 479B
settings.gradle 43B
win32_window.h 3KB
win32_window.h 3KB
flutter_window.h 1KB
flutter_window.h 1KB
run_loop.h 1KB
run_loop.h 1KB
my_application.h 553B
my_application.h 553B
utils.h 397B
共 314 条
- 1
- 2
- 3
- 4
资源评论
weixin_42979948
- 粉丝: 0
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- JAVAjava电子相册管理系统源码数据库 MySQL源码类型 WebForm
- BERT情感分析数据集
- 第二次培训(1)(1).zip
- 双闭环可逆pwm(matlab仿真)
- JAVAspringboot学生课程查询系统源码数据库 MySQL源码类型 WebForm
- 伯克利大学机器学习-14Optimization methods for learning [John Duchi]
- springboot4d8g9.sql
- (源码)基于SpringBoot和SpringSecurity的系统组织架构管理.zip
- JAVA的Springboot果蔬配送商城源码数据库 MySQL源码类型 WebForm
- (源码)基于C++的简单关系型数据库管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功