### CI/CD Integration Example Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Example of integrating FlutterFlow CLI into a GitHub Actions workflow for automated builds and deployments. ```APIDOC ## CI/CD Integration with GitHub Actions ### Description This example demonstrates how to set up a GitHub Actions workflow to automatically export a FlutterFlow project, build it, and deploy it to Firebase. ### Method YAML Configuration (GitHub Actions Workflow) ### Endpoint N/A (CI/CD workflow configuration) ### Parameters #### Workflow Steps - **Checkout Code**: Uses `actions/checkout@v3` to get the repository code. - **Setup Dart**: Uses `dart-lang/setup-dart@v1` to set up the Dart environment. - **Setup Flutter**: Uses `subosito/flutter-action@v2` to set up the Flutter SDK. - **Install FlutterFlow CLI**: Activates the `flutterflow_cli` globally using `dart pub global activate`. - **Export FlutterFlow Code**: Runs the `flutterflow export-code` command with specified options and environment variables for token and project ID. - **Build Web**: Executes `flutter build web` within the exported project directory. - **Deploy to Firebase**: Runs `flutterflow deploy-firebase` to deploy Firebase-related configurations. #### Environment Variables - **FLUTTERFLOW_API_TOKEN**: Secret containing the FlutterFlow API token. - **FLUTTERFLOW_PROJECT**: Secret containing the FlutterFlow project ID. ### Request Example ```yaml # .github/workflows/main.yml name: Build FlutterFlow Project on: workflow_dispatch: schedule: - cron: '0 6 * * *' # Daily at 6 AM jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 - uses: subosito/flutter-action@v2 with: flutter-version: '3.19.0' - name: Install FlutterFlow CLI run: dart pub global activate flutterflow_cli - name: Export FlutterFlow Code env: FLUTTERFLOW_API_TOKEN: ${{ secrets.FLUTTERFLOW_API_TOKEN }} FLUTTERFLOW_PROJECT: ${{ secrets.FLUTTERFLOW_PROJECT }} run: | flutterflow export-code \ --dest ./app \ --include-assets \ --no-parent-folder \ --fix - name: Build Web working-directory: ./app run: flutter build web - name: Deploy to Firebase env: FLUTTERFLOW_API_TOKEN: ${{ secrets.FLUTTERFLOW_API_TOKEN }} FLUTTERFLOW_PROJECT: ${{ secrets.FLUTTERFLOW_PROJECT }} run: flutterflow deploy-firebase ``` ### Response N/A (Executes build and deployment steps within the CI/CD environment) ``` -------------------------------- ### Deploy Firebase Prerequisites Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Install Firebase CLI tools globally using npm and log in to your Firebase account. These are prerequisites for deploying to Firebase. ```bash # Install prerequisites npm install -g firebase-tools firebase login ``` -------------------------------- ### Install FlutterFlow CLI Source: https://github.com/flutterflow/flutterflow-cli/blob/main/example/README.md Activate the flutterflow_cli package globally using Dart Pub. This command is required before using any flutterflow commands. ```sh dart pub global activate flutterflow_cli ``` -------------------------------- ### CI/CD Integration for FlutterFlow Projects Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Integrate the FlutterFlow CLI into your CI/CD pipeline for automated builds and deployments. This example demonstrates a GitHub Actions workflow for building and deploying a FlutterFlow project. ```yaml # .github/workflows/main.yml name: Build FlutterFlow Project on: workflow_dispatch: schedule: - cron: '0 6 * * *' # Daily at 6 AM jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 - uses: subosito/flutter-action@v2 with: flutter-version: '3.19.0' - name: Install FlutterFlow CLI run: dart pub global activate flutterflow_cli - name: Export FlutterFlow Code env: FLUTTERFLOW_API_TOKEN: ${{ secrets.FLUTTERFLOW_API_TOKEN }} FLUTTERFLOW_PROJECT: ${{ secrets.FLUTTERFLOW_PROJECT }} run: | flutterflow export-code \ --dest ./app \ --include-assets \ --no-parent-folder \ --fix - name: Build Web working-directory: ./app run: flutter build web - name: Deploy to Firebase env: FLUTTERFLOW_API_TOKEN: ${{ secrets.FLUTTERFLOW_API_TOKEN }} FLUTTERFLOW_PROJECT: ${{ secrets.FLUTTERFLOW_PROJECT }} run: flutterflow deploy-firebase ``` -------------------------------- ### Deploy to Firebase Source: https://github.com/flutterflow/flutterflow-cli/blob/main/README.md Deploy your FlutterFlow project to Firebase. Ensure `firebase-tools` is installed. The project ID and API token can be set via environment variables. Existing Firestore rules can be appended or overwritten. ```bash flutterflow deploy-firebase --project --[no]-append-rules --token ``` -------------------------------- ### Export Code - Basic Usage Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Download generated Flutter source code. Provide project ID and API token via flags or environment variables. The `--dest` flag specifies the output directory. ```bash # Export using command-line flags flutterflow export-code --project YOUR_PROJECT_ID --dest ./output --token YOUR_API_TOKEN ``` ```bash # Export using environment variables export FLUTTERFLOW_API_TOKEN="your-api-token" export FLUTTERFLOW_PROJECT="your-project-id" flutterflow export-code --dest ./output ``` ```bash # Export to current directory with parent folder structure flutterflow export-code \ --project app-with-assets-qxwg6o \ --token sk_flutterflow_xxxxxxxx \ --dest ./projects ``` -------------------------------- ### Deploy Firebase Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Deploy Firestore security rules and Cloud Functions to Firebase. Use `--append-rules` to add to existing rules instead of overwriting. ```bash # Deploy to Firebase (overwrites existing rules) flutterflow deploy-firebase \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN ``` ```bash # Deploy to Firebase (append to existing rules) flutterflow deploy-firebase \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --append-rules ``` -------------------------------- ### Export Code - Include Assets Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Include all project assets like images and fonts during code export by using the `--include-assets` flag. Use `--no-parent-folder` to export directly into the destination directory. ```bash # Export with all media assets (images, fonts, etc.) flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./output \ --include-assets ``` ```bash # Export without parent folder, directly to destination flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./my-flutter-app \ --include-assets \ --no-parent-folder ``` -------------------------------- ### FlutterFlowIgnore - Selective File Preservation Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Create a `.flutterflowignore` file in your output directory to prevent specific files from being overwritten during subsequent exports. Uses glob syntax for pattern matching. ```bash # Create .flutterflowignore in your project root cat > ./my-project/.flutterflowignore << 'EOF' # Preserve custom modifications lib/custom/** lib/main.dart EOF ``` -------------------------------- ### FlutterFlow CLI - Export Code Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Command-line interface for exporting FlutterFlow projects. Allows for selective file preservation and customization of the export process. ```APIDOC ## flutterflow export-code ### Description Exports FlutterFlow project code to a local directory, with options to preserve specific files or file types. ### Method CLI Command ### Endpoint N/A (Local command-line tool) ### Parameters #### Command-line Arguments - **--project** (string) - Required - The ID of the FlutterFlow project to export. - **--token** (string) - Required - The API token for authentication. - **--dest** (string) - Required - The destination path for the exported code. - **--no-parent-folder** - Optional - Do not create a parent folder for the exported code. - **--include-assets** - Optional - Include project assets in the export. - **--fix** - Optional - Apply code fixes to the exported code. - **--as-module** - Optional - Export the code as a module. - **--as-debug** - Optional - Export the code as a debug build. - **--format** - Optional - Format the exported code. - **--include-export-manifest** - Optional - Include the export manifest file. - **--branch-name** (string) - Optional - The name of the branch to export. - **--environment-name** (string) - Optional - The name of the environment to export. - **--unzip-to-parent-folder** - Optional - Unzip the exported code to the parent folder. - **--endpoint** (string) - Optional - Custom API endpoint URL. ### Request Example ```bash flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./my-project \ --no-parent-folder ``` ### Response N/A (Outputs files to the specified destination) ``` -------------------------------- ### Export FlutterFlow Code Command Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Use this command to export FlutterFlow project code. Specify your project ID, API token, and destination path. Options like `--include-assets` and `--no-parent-folder` customize the export. ```bash flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./my-project \ --no-parent-folder ``` -------------------------------- ### Export Manifest Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Include the export manifest file with the `--include-export-manifest` flag. This file maps FlutterFlow entities to generated files, useful for tooling integration. ```bash # Export with manifest for tooling integration flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./output \ --include-export-manifest ``` -------------------------------- ### Export FlutterFlow Project Code with Environment Variable Source: https://github.com/flutterflow/flutterflow-cli/blob/main/example/README.md Export code without explicitly providing the API token by setting the `FLUTTERFLOW_API_TOKEN` environment variable. This is a more secure way to handle sensitive tokens. ```sh flutterflow export-code --project ProjectID ``` -------------------------------- ### Programmatic API - FlutterFlowApi.export() Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Programmatic interface for exporting FlutterFlow projects using Dart. Allows for detailed control over export options within Dart applications. ```APIDOC ## FlutterFlowApi.export() ### Description Exports a FlutterFlow project programmatically using Dart. This function provides a comprehensive set of options for customizing the export process. ### Method Dart Function ### Endpoint N/A (Dart library function) ### Parameters #### Function Parameters - **token** (string) - Required - The API token for authentication. - **projectId** (string) - Required - The ID of the FlutterFlow project to export. - **destinationPath** (string) - Required - The destination path for the exported code. - **includeAssets** (bool) - Optional - Whether to include project assets. - **branchName** (string) - Optional - The name of the branch to export. - **environmentName** (string) - Optional - The name of the environment to export. - **unzipToParentFolder** (bool) - Optional - Whether to unzip the exported code to the parent folder. - **fix** (bool) - Optional - Whether to apply code fixes. - **exportAsModule** (bool) - Optional - Whether to export the code as a module. - **exportAsDebug** (bool) - Optional - Whether to export the code as a debug build. - **format** (bool) - Optional - Whether to format the exported code. - **includeExportManifest** (bool) - Optional - Whether to include the export manifest file. - **endpoint** (string) - Optional - Custom API endpoint URL. ### Request Example ```dart import 'package:flutterflow_cli/flutterflow_cli.dart'; Future main() async { try { // Basic export final projectFolder = await FlutterFlowApi.export( token: 'your-api-token', projectId: 'your-project-id', destinationPath: './output', includeAssets: true, ); print('Exported to: $projectFolder'); // Full export with all options final fullExport = await FlutterFlowApi.export( token: 'your-api-token', projectId: 'your-project-id', destinationPath: './output', includeAssets: true, branchName: 'main', environmentName: 'Production', unzipToParentFolder: true, fix: true, exportAsModule: false, exportAsDebug: false, format: true, includeExportManifest: true, endpoint: 'https://api.flutterflow.io/v2', // optional custom endpoint ); print('Full export completed to: $fullExport'); } catch (e) { print('Export failed: $e'); } } ``` ### Response - **Future** - A future that completes with the path to the exported project folder. ``` -------------------------------- ### Programmatic Code Export with FlutterFlowApi Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Utilize the FlutterFlow CLI as a Dart library for programmatic code export within your Dart/Flutter applications. The `FlutterFlowApi.export` method allows for basic and full exports with various configuration options. ```dart import 'package:flutterflow_cli/flutterflow_cli.dart'; Future main() async { try { // Basic export final projectFolder = await FlutterFlowApi.export( token: 'your-api-token', projectId: 'your-project-id', destinationPath: './output', includeAssets: true, ); print('Exported to: $projectFolder'); // Full export with all options final fullExport = await FlutterFlowApi.export( token: 'your-api-token', projectId: 'your-project-id', destinationPath: './output', includeAssets: true, branchName: 'main', environmentName: 'Production', unzipToParentFolder: true, fix: true, exportAsModule: false, exportAsDebug: false, format: true, includeExportManifest: true, endpoint: 'https://api.flutterflow.io/v2', // optional custom endpoint ); print('Full export completed to: $fullExport'); } catch (e) { print('Export failed: $e'); } } ``` -------------------------------- ### Export Code - Branch and Commit Selection Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Export code from a specific Git branch or commit hash for version control integration. Supports specifying a project environment. ```bash # Export from a specific branch flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./output \ --branch-name feature-branch ``` ```bash # Export from a specific commit flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./output \ --commit-hash 0jfsCktnCmIcNp02q3yW ``` ```bash # Export with environment configuration flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_API_TOKEN \ --dest ./output \ --project-environment Development ``` -------------------------------- ### Export FlutterFlow Project Code Source: https://github.com/flutterflow/flutterflow-cli/blob/main/example/README.md Use the `flutterflow export-code` command with your Project ID and API Token. Ensure you have the correct ProjectID and APIToken. ```sh flutterflow export-code --project ProjectID --token APIToken ``` -------------------------------- ### Export Code - Dart Fix and Module Generation Source: https://context7.com/flutterflow/flutterflow-cli/llms.txt Automatically apply Dart code fixes with the `--fix` flag. Export as a Flutter module using `--as-module` for embedding. Use `--as-debug` to include debug instrumentation. ```bash # Export and automatically apply dart fix for cleaner code flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./output \ --fix ``` ```bash # Export as a Flutter module for embedding flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./output \ --as-module ``` ```bash # Export with debug instrumentation for FlutterFlow Debug Panel flutterflow export-code \ --project YOUR_PROJECT_ID \ --token YOUR_API_TOKEN \ --dest ./output \ --as-debug ``` -------------------------------- ### Export FlutterFlow Project Code Source: https://github.com/flutterflow/flutterflow-cli/blob/main/README.md Export code from a FlutterFlow project to a specified destination folder. Assets, manifest files, and debugging options can be included or excluded. The project ID and output folder can be set via environment variables. ```bash flutterflow export-code --project --dest --[no-]include-assets --token --[no-]fix --[no-]parent-folder --[no-]as-module --[no-]as-debug --[no-]include-export-manifest ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.