flutter_native_toolkit 1.0.5
flutter_native_toolkit: ^1.0.5 copied to clipboard
A powerful CLI tool to automate native Android and iOS configuration in Flutter projects. Set minSdkVersion, add permissions, configure Info.plist, and more with simple commands.
Flutter Native Toolkit #
A powerful CLI tool to automate native Android and iOS configuration in Flutter projects. Stop manually editing AndroidManifest.xml, build.gradle, and Info.plist files!
Features #
- 100+ Pre-configured Permissions - Comprehensive permission database with Android and iOS mappings
- Add/Remove Permissions - Full CRUD operations for permissions on both platforms
- Set Android minSdkVersion - Update
build.gradleorbuild.gradle.kts - Add iOS Plist Keys - Configure
Info.plistentries - URL Schemes - Add deep linking support for iOS
- Android Features - Add
uses-featuretags to manifest - Status Command - View current native configuration
- Init Templates - Quick setup for common app types (social, ecommerce, maps, etc.)
- Smart Input Parsing - Warns when using
.instead of,to separate permissions - Interactive Mode - Guided permission selection by category
- Cross-Platform - Works on Windows, macOS, and Linux
Installation #
Global Activation (Recommended) #
dart pub global activate flutter_native_toolkit
Then use from any Flutter project:
flutter_native_toolkit <command>
Local Installation #
Add to your dev_dependencies:
dev_dependencies:
flutter_native_toolkit: ^1.0.5
Run with:
dart run flutter_native_toolkit <command>
Quick Start #
# View current configuration
flutter_native_toolkit status
# Initialize with a template
flutter_native_toolkit init -t social
# Add permissions (comma-separated)
flutter_native_toolkit add-permission -n camera,location,microphone
# Remove a permission
flutter_native_toolkit remove-permission -n camera
# Set Android SDK version
flutter_native_toolkit set-sdk -v 23
# Add URL scheme for deep linking
flutter_native_toolkit add-url-scheme -s myapp
# Interactive mode
flutter_native_toolkit add-permission -i
Commands Reference #
status - View Configuration #
Show current native Android and iOS configuration.
flutter_native_toolkit status
Output:
Native Configuration Status
==================================================
Android
------------------------------
minSdkVersion: 23
Permissions (3):
- INTERNET
- CAMERA
- ACCESS_FINE_LOCATION
Features (1):
- camera (required)
iOS
------------------------------
Permission Keys (2):
- NSCameraUsageDescription
- NSLocationWhenInUseUsageDescription
URL Schemes (1):
- myapp://
init - Initialize with Templates #
Quick setup with common permissions for your app type.
flutter_native_toolkit init -t <template>
Available Templates:
| Template | Permissions |
|---|---|
social |
camera, microphone, images, contacts, notifications |
ecommerce |
internet, notifications, camera, location |
maps |
location, coarse_location, background_location, internet |
media |
camera, microphone, images, video, audio_files, write_storage |
chat |
camera, microphone, contacts, notifications, internet |
fitness |
activity_recognition, sensors, location, health, notifications |
Example:
flutter_native_toolkit init -t social
add-permission - Add Permissions #
Add permission(s) to Android and/or iOS.
flutter_native_toolkit add-permission [options]
Options:
| Option | Short | Description |
|---|---|---|
--name |
-n |
Permission key(s), comma-separated |
--platform |
-p |
Target: android, ios, or both (default) |
--ios-description |
-d |
Custom iOS usage description |
--interactive |
-i |
Launch interactive selector |
--list |
-l |
List all available permissions |
Examples:
# Single permission
flutter_native_toolkit add-permission -n camera
# Multiple permissions (comma-separated)
flutter_native_toolkit add-permission -n camera,location,microphone
# Android only
flutter_native_toolkit add-permission -n internet -p android
# iOS with custom description
flutter_native_toolkit add-permission -n camera -p ios -d "Camera needed for QR scanning"
# Interactive mode
flutter_native_toolkit add-permission -i
# List all permissions
flutter_native_toolkit add-permission -l
remove-permission - Remove Permissions #
Remove permission(s) from Android and/or iOS.
flutter_native_toolkit remove-permission -n <permission> [options]
Options:
| Option | Short | Description |
|---|---|---|
--name |
-n |
Permission key(s) to remove, comma-separated |
--platform |
-p |
Target: android, ios, or both (default) |
Examples:
# Remove single permission
flutter_native_toolkit remove-permission -n camera
# Remove multiple permissions
flutter_native_toolkit remove-permission -n camera,location
# Remove from Android only
flutter_native_toolkit remove-permission -n internet -p android
set-sdk - Set Android minSdkVersion #
Update the minSdkVersion in build.gradle.
flutter_native_toolkit set-sdk -v <version>
Examples:
# Set to API 23 (Android 6.0)
flutter_native_toolkit set-sdk -v 23
# Set to API 26 (Android 8.0)
flutter_native_toolkit set-sdk -v 26
Supports:
- Groovy DSL:
minSdkVersion 21 - Kotlin DSL:
minSdk = 21 - Variable references:
flutter.minSdkVersion
add-url-scheme - Add URL Scheme #
Add URL scheme to iOS for deep linking.
flutter_native_toolkit add-url-scheme -s <scheme>
Example:
flutter_native_toolkit add-url-scheme -s myapp
# Your app can now be opened with: myapp://path/to/content
add-feature - Add Android Feature #
Add uses-feature tag to AndroidManifest.xml.
flutter_native_toolkit add-feature -n <feature> [options]
Options:
| Option | Short | Description |
|---|---|---|
--name |
-n |
Feature name (e.g., camera or android.hardware.camera) |
--required |
-r |
Whether feature is required (default: true) |
Examples:
# Required feature
flutter_native_toolkit add-feature -n camera
# Optional feature
flutter_native_toolkit add-feature -n camera --no-required
# Full feature name
flutter_native_toolkit add-feature -n android.hardware.bluetooth_le -r
add-plist - Add iOS Plist Key #
Add key-value pair to iOS Info.plist.
flutter_native_toolkit add-plist -k <key> -v <value> [options]
Options:
| Option | Short | Description |
|---|---|---|
--key |
-k |
Plist key name |
--value |
-v |
Value for the key |
--type |
-t |
Type: string, boolean, integer, array |
Examples:
# String value
flutter_native_toolkit add-plist -k CFBundleDisplayName -v "My App"
# Boolean value
flutter_native_toolkit add-plist -k UIRequiresFullScreen -v true -t boolean
# Integer value
flutter_native_toolkit add-plist -k MinimumOSVersion -v 12 -t integer
list-permissions - List Permissions #
Display all available permissions by category.
flutter_native_toolkit list-permissions [options]
Options:
| Option | Short | Description |
|---|---|---|
--category |
-c |
Filter by category |
Examples:
# List all
flutter_native_toolkit list-permissions
# Filter by category
flutter_native_toolkit list-permissions -c camera
flutter_native_toolkit list-permissions -c location
add-dep - Add Dependency #
Quick wrapper for flutter pub add.
flutter_native_toolkit add-dep -n <package> [options]
Examples:
# Regular dependency
flutter_native_toolkit add-dep -n http
# Dev dependency
flutter_native_toolkit add-dep -n mockito -d
Permission Categories #
| Category | Count | Description |
|---|---|---|
| Network & Connectivity | 21 | Internet, WiFi, foreground services |
| Camera & Media Capture | 3 | Camera, microphone, flashlight |
| Location Services | 5 | Fine/coarse/background location |
| Storage & Files | 12 | Photos, videos, documents |
| Contacts & Calendar | 5 | Contacts, calendar, reminders |
| Phone & SMS | 17 | Calls, SMS, voicemail |
| Bluetooth & NFC | 9 | Bluetooth LE, NFC |
| Sensors & Biometrics | 8 | Fingerprint, Face ID, motion |
| System & Notifications | 67 | Notifications, alarms, settings |
Total: 100+ permissions
Common Permissions #
| Key | Android | iOS |
|---|---|---|
camera |
CAMERA |
NSCameraUsageDescription |
microphone |
RECORD_AUDIO |
NSMicrophoneUsageDescription |
location |
ACCESS_FINE_LOCATION |
NSLocationWhenInUseUsageDescription |
contacts_read |
READ_CONTACTS |
NSContactsUsageDescription |
calendar_read |
READ_CALENDAR |
NSCalendarsUsageDescription |
biometric |
USE_BIOMETRIC |
NSFaceIDUsageDescription |
bluetooth |
BLUETOOTH |
NSBluetoothAlwaysUsageDescription |
images |
READ_MEDIA_IMAGES |
NSPhotoLibraryUsageDescription |
notifications |
POST_NOTIFICATIONS |
- |
internet |
INTERNET |
- |
Run flutter_native_toolkit list-permissions to see all permissions.
Smart Input Handling #
The tool detects common input mistakes:
# Mistake: Using . instead of ,
flutter_native_toolkit add-permission -n camera.location
# Warning: It looks like you used "." instead of "," to separate permissions
# Did you mean: camera, location?
The tool will still attempt to process the permissions correctly.
Interactive Mode #
Launch the interactive permission selector:
flutter_native_toolkit add-permission -i
Features:
- Browse by category
- Multi-select with
1,3,5orall - iOS compatibility indicators
[iOS] - Review before adding
Programmatic Usage #
Use as a library in your Dart code:
import 'package:flutter_native_toolkit/flutter_native_toolkit.dart';
void main() {
final projectRoot = '/path/to/flutter/project';
// Android Manager
final android = AndroidManager(projectRoot);
// Add permission
final result = android.addPermission('android.permission.CAMERA');
switch (result) {
case Success(:final message):
print('Success: $message');
case Failure(:final error):
print('Error: $error');
}
// Remove permission
android.removePermission('android.permission.CAMERA');
// Add feature
android.addFeature('android.hardware.camera', required: true);
// Get current config
print('minSdk: ${android.getMinSdkVersion()}');
print('Permissions: ${android.getPermissions()}');
// iOS Manager
final ios = IosManager(projectRoot);
// Add plist key
ios.addPlistKey('NSCameraUsageDescription', 'Camera needed');
// Add URL scheme
ios.addUrlScheme('myapp');
// Get current config
print('iOS Permissions: ${ios.getPermissionKeys()}');
print('URL Schemes: ${ios.getUrlSchemes()}');
}
Error Handling #
Clear error messages guide you:
# Not in Flutter project
$ flutter_native_toolkit set-sdk -v 23
Error: Not a Flutter/Dart project. Could not find pubspec.yaml.
# Invalid permission
$ flutter_native_toolkit add-permission -n invalid
Warning: Permission "invalid" not found. Use --list to see available permissions.
# Missing directory
$ flutter_native_toolkit add-url-scheme -s myapp
Error: iOS directory not found. Run "flutter create ." to add iOS support.
Requirements #
- Dart SDK:
^3.2.0 - Flutter project with
pubspec.yaml - Android commands:
android/directory required - iOS commands:
ios/directory required
Dependencies #
dependencies:
args: ^2.5.0 # CLI argument parsing
xml: '>=6.5.0 <8.0.0' # AndroidManifest.xml parsing
path: ^1.9.0 # Cross-platform paths
Contributing #
Development setup #
The repository root is a Dart CLI package. The example/ directory is a
separate Flutter app with Android and iOS configuration files for trying the CLI.
Use Dart 3.2 or later for the CLI. The example requires Dart 3.9.2 or later, provided by a compatible Flutter SDK. If standalone Dart and Flutter use different Dart versions, use the Dart executable bundled with Flutter for both.
On Windows PowerShell, select Flutter's Dart for the current terminal before running the commands below:
$flutterBin = Split-Path (Get-Command flutter).Source
$env:PATH = "$flutterBin;$env:PATH"
dart --version
From the repository root:
dart pub get
dart analyze
dart test
dart run flutter_native_toolkit --help
Set up and check the example:
cd example
flutter pub get
flutter analyze
flutter test
dart run ../bin/flutter_native_toolkit.dart status
See example/README.md for commands that modify the example's
native configuration. Run flutter doctor -v to check platform build tools.
Building iOS apps requires macOS and Xcode; editing Info.plist with this CLI
works on Windows, macOS, and Linux.
Contributions welcome! Please:
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open a Pull Request
License #
MIT License - see LICENSE for details.
Support #
Made with Dart for Flutter developers