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

插件详情v0.0.14

permission_config

一个 Flutter CLI 插件,可自动添加 Android/iOS 权限并生成权限处理逻辑。

AndroidiOS
近 30 天下载
30
喜欢数
37
Pub 分数
150

安装插件

flutter pub add permission_config

插件介绍

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

一个 Flutter CLI 插件,可自动添加 Android 和 iOS 权限,并生成相应的权限处理代码。它通过减少手动配置来简化应用开发,确保在平台特定的清单文件中正确声明权限,并生成请求和检查权限的样板代码。非常适合希望缩短设置时间并避免应用部署过程中常见权限相关错误的开发者。

适合场景

  • 为新Flutter项目自动设置权限
  • 减少 AndroidManifest.xml 和 Info.plist 中的手动配置
  • 为运行时检查生成权限请求逻辑
  • 通过一致的权限处理加速应用开发
  • 确保符合平台特定的权限要求

主要特点

  • CLI 驱动的权限配置
  • 权限处理代码的自动生成
  • 同时支持 Android 和 iOS 平台
  • 与现有 Flutter 项目集成
  • 所需人工干预最少

适合对象

  • Flutter 初学者学习权限管理
  • 旨在跨项目标准化权限设置的团队
  • 需要多个权限的应用程序的开发者
  • 对移动权限有严格合规要求的项目
  • 快速原型设计与安全权限处理

使用建议

  • 需要熟悉 Flutter CLI
  • 可能需要在自动生成后进行定制
  • 本身不是运行时权限管理器
  • 依赖外部 permission_handler 包
  • 在项目开发初期使用效果最佳

原始 README

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

🚀 Permission Config

A Flutter CLI plugin that automatically adds Android/iOS permissions (Camera, Microphone, Location) to your Flutter project and generates a ready-to-use runtime permission handler file.
Say goodbye to manually editing AndroidManifest.xml and Info.plist — this tool does it all for you!


✨ Features

  • ✅ ✅ Supports permissions for Camera, Microphone, Location, Storage, Bluetooth, Sensors, Contacts, Calendar, Photos, Notifications, and Speech Recognition
  • ⚙️ Automatically injects required Android and iOS permission entries
  • 📁 Generates a pre-written permission_handler.dart file under lib/Utils/
  • 📦 Adds permission_handler dependency automatically in your pubspec.yaml
  • 💾 Creates backup files (.bak) before modifying platform configs
  • 📝 Uses logger for clean, informative CLI output

📦 Installation

Activate the plugin globally with Dart pub:

dart pub global activate permission_config

🔧 Usage

Run this command inside your Flutter project root:

permission_config <permission> [optional-ios-message]
Supported permissions:
Permission Aliases Description
camera - Access to the device camera
microphone mic Access to the microphone
location - Access to device location services (fine & coarse)
storage - Read/write external storage (Android only)
bluetooth - Access Bluetooth and BLE devices
sensors - Access body sensors and motion data
contacts - Access the user's contact list
calendar - Access calendar events and reminders
photos - Access the photo library (iOS only)
notifications - Access to send and display notifications (iOS only)
speech - Use speech recognition services (iOS only)
all - Adds all supported permissions above automatically
Examples:
permission_config all
permission_config camera
permission_config mic "This app needs mic access for voice chat."
permission_config location

💾 Backup Files

Before applying changes, backups are created:

  • AndroidManifest.xml.bak
  • Info.plist.bak

🙌 Contribution

Found a bug or want to add more permissions?
Feel free to open an issue or submit a pull request! Your contributions are welcome. 💙


👤 Contributors

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。