搜索插件、代码仓与 APP 分类

插件详情v13.0.2

permission_handler

Flutter 的权限插件。此插件提供跨平台(iOS、Android)的 API,用于请求和检查权限。

AndroidiOSWebWindows
近 30 天下载
393万
喜欢数
6020
Pub 分数
160

安装插件

flutter pub add permission_handler

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

permission_handler 包为 Flutter 应用程序提供了一个跨平台 API,用于在 Android、iOS、Web 和 Windows 上请求和检查设备权限。它通过一致且与平台无关的方法,简化了对相机、麦克风、位置和存储访问等敏感用户权限的处理。该插件确保在不同操作系统上实现安全可靠的权限管理,减少样板代码并提升开发体验。它可无缝集成到 Flutter 生态系统中,并支持运行时权限请求和状态检查。

适合场景

  • 在照片应用中请求相机访问权限
  • 在使用GPS功能之前检查位置权限
  • 管理文件上传的存储访问
  • 处理语音录制应用中的麦克风权限
  • 确保符合隐私法规

主要特点

  • 跨平台支持(Android、iOS、Web、Windows)
  • 用于请求和检查权限的简单 API
  • 支持运行时权限处理
  • 返回详细的权限状态
  • 与Flutter工作流程集成良好

适合对象

  • 需要设备硬件访问权限的应用程序
  • 注重隐私的应用程序
  • 跨平台 Flutter 项目
  • 寻求一致权限处理的开发者
  • 需要符合平台特定权限策略的项目

使用建议

  • 需要在平台特定的文件中进行正确配置(例如,Info.plist、AndroidManifest.xml)
  • 可能需要用户交互以授予权限
  • 不会自动处理所有边缘情况
  • 限于标准系统权限
  • 取决于对 async/await 模式的正确使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter permission_handler plugin

The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation of the federated plugin concept can be found in the Flutter documentation. This means the permission_handler plugin is separated into the following packages:

  1. permission_handler: the app facing package. This is the package users depend on to use the plugin in their project. For details on how to use the permission_handler plugin you can refer to its README.md file. At this moment the Android and iOS platform implementations are also part of this package. Additional platform support will be added in their own individual "platform package(s)".
  2. permission_handler_platform_interface: this packages declares the interface which all platform packages must implement to support the app-facing package. Instructions on how to implement a platform packages can be found in the README.md of the permission_handler_platform_interface package.

所属分类

依赖

依赖清单 6 项

  • meta^1.7.0
  • permission_handler_android^14.1.0
  • permission_handler_apple^9.5.0
  • permission_handler_html^0.1.4+0
  • permission_handler_platform_interface^4.4.0
  • permission_handler_windows^0.2.2

源码仓库

使用此插件的项目

所在榜单