fire_pilot 1.0.5
fire_pilot: ^1.0.5 copied to clipboard
Elite Firebase setup orchestrator for Flutter. Automates Node.js install, multi-account login, project creation, and SHA registration.
๐ FirePilot #
FirePilot is the elite command-line companion for Flutter developers who want to skip the frustration of Firebase setup. It's a "one-click" orchestrator that automates everything from Node.js installation to SHA key registration.
๐ฅ Why FirePilot? #
The official Firebase CLI is powerful, but it requires many manual steps. FirePilot bridges the gap by automating the boring parts:
- ๐ ๏ธ Self-Healing Environment: Automatically detects and installs Node.js/NPM (via Winget on Windows or Homebrew on macOS).
- ๐ Smart PATH Injection: No terminal restarts required. Newly installed tools work instantly.
- ๐ฅ Multi-Account Support: Effortlessly switch between multiple client Google accounts directly from an interactive menu.
- ๐ Automatic SHA Extraction: Automatically finds and registers SHA-1 and SHA-256 certificates for your Android apps.
- ๐ฐ๏ธ Intelligent Orchestration: Combines Firebase project creation, FlutterFire configuration, and dependency setup into a single flow.
- ๐ Real-Time Diagnostics: Interactive error reporting that actually tells you why a project creation failed (e.g., Quota exceeded).
๐ Usage #
Activate FirePilot globally using Dart:
dart pub global activate fire_pilot
Usage #
Run the full setup wizard inside your Flutter project:
fire_pilot firebase setup --full
Available Commands #
| Command | Description |
|---|---|
firebase setup --full |
The complete "Pilot" experience: Tools -> Login -> Project -> FlutterFire -> Deps -> SHA. |
firebase sha add |
Automatically extract and add SHA keys to your Firebase project. |
firebase login |
Manage and switch between multiple Google accounts. |
firebase enable <feature> |
Quickly enable Firebase features (auth, firestore, etc). |
firebase force-update |
Generate a Remote Config Force Update service and UI Dialogs. |
๐ Firebase Force Update Setup #
Setting up a force-update or optional-update mechanism is as simple as running:
fire_pilot firebase force-update --path=lib/services/remote_config_service.dart
This command will:
- Add necessary dependencies (
firebase_remote_config,package_info_plus, andurl_launcher) to yourpubspec.yaml. - Generate a ready-to-use
RemoteConfigServiceclass at the specified path. - Auto-generate premium, beautiful dialogs (
ForceUpdateDialogandOptionalUpdateDialog) insideupdate_dialogs.dartin the same directory.
๐ฐ๏ธ Firebase Console Setup
In your Firebase Console, navigate to Remote Config and add the following parameters:
| Parameter Key | Type | Default Value | Description |
|---|---|---|---|
is_force_update |
Boolean | false |
If true, all users with an app version below the latest version (current_version) will be forced to update. |
min_version_android |
String | 1.0.0 |
The minimum required Android version. Users below this version are always forced to update (even if is_force_update is false). |
min_version_ios |
String | 1.0.0 |
The minimum required iOS version. Users below this version are always forced to update (even if is_force_update is false). |
latest_version_android |
String | 1.0.0 |
The latest available Android version. Triggers force update if is_force_update is true, otherwise triggers optional update for older versions. |
latest_version_ios |
String | 1.0.0 |
The latest available iOS version. Triggers force update if is_force_update is true, otherwise triggers optional update for older versions. |
store_url_android |
String | https://play.google.com/store/apps/details?id=your.package |
Play Store URL of your app. |
store_url_ios |
String | https://apps.apple.com/app/idyour-app-id |
App Store URL of your app. |
๐ป Integration Code Snippet
To use the generated service in your Flutter application:
-
Initialize in
main.dart:void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); // Initialize the RemoteConfigService final remoteConfig = RemoteConfigService(); await remoteConfig.initialize(); runApp(const MyApp()); } -
Trigger Dialog Checks on App Launch: Call the dialog trigger inside the
initStateof your main screen widget (e.g.,HomeScreenorMyHomePage, not in the rootMyAppwidget, since the context needs to be a descendant ofMaterialAppto access the navigator and localizations):@override void initState() { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { // Automatically checks configuration and shows the correct dialog RemoteConfigService().checkAndShowUpdateDialog(context); }); }
๐งช Testing Force Updates (QA & Development)
To safely test the Force/Optional update popups with your QA team or developers without impacting live production users (if you share the same Firebase Project), you can use custom Firebase User Properties:
- Add Firebase Analytics: Ensure
firebase_analyticsis set up in your Flutter project. - Set User Property on QA Devices: Set a custom property (e.g.,
app_environment=qa) on devices used by developers or QA testers. This can be enabled dynamically (e.g., usingkDebugModeor an environment flag):import 'package:firebase_analytics/firebase_analytics.dart'; await FirebaseAnalytics.instance.setUserProperty( name: 'app_environment', value: 'qa', ); - Configure Remote Config Values:
- Go to your Firebase Console under Remote Config.
- Edit the parameter you want to test (e.g.,
is_force_updateormin_version_android). - Click Add value for condition -> Create new condition.
- Define a condition (e.g., "QA Testers") based on User Property where
app_environmentmatchesqa. - Set the overridden values for this condition (e.g.
is_force_update = true). - Save and publish. Only devices with the
app_environmentuser property set toqawill receive the overridden values.
๐ ๏ธ Required Tools #
FirePilot is smart enough to help you install these if they are missing:
- Flutter & Dart SDK
- Node.js & NPM
- Firebase CLI
- FlutterFire CLI
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Contributing #
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Made with โค๏ธ for the Flutter community.