HarmonyOS next之Flutter+鸿蒙NEXT开发获取系统文件路径
在具体的开发过程中,有时需要获取临时目录、文档目录等需求.本文具体讲解怎么在Flutter中可以利用path_provider插件来完成此项工作,OpenHarmony SIG组织对该插件做了鸿蒙NEXT系统的适配,接下来将详细讲解如何利用path_provider插件来获取系统文件路径。
在引用的项目中,pubspec.yaml中dependencies新增配置:
dependencies:
path_provider:
git:
url: "https://gitee.com/openharmony-sig/flutter_packages.git"
path: "packages/path_provider/path_provider"
项目根目录运行flutter pub get;(ohos/entry/oh-package.json5会自动添加如下相关插件har依赖)
{
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {
"@ohos/flutter_ohos": "file:../har/flutter.har",
"integration_test": "file:../har/integration_test.har",
"path_provider_ohos": "file:../har/path_provider_ohos.har"
}
}
导入path_provider插件</

最低0.47元/天 解锁文章
752

被折叠的 条评论
为什么被折叠?



