### Install Dependencies and Start Local Server
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/README.md
Run these commands in your terminal to install project dependencies and start a local development server for previewing changes.
```bash
npm install
npm run start
```
--------------------------------
### Launch Agent After Workspace Setup
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/advanced/flutterflow-cli/flutterflow-mcp.md
After initializing the workspace, navigate into the workspace directory and launch your registered agent. This example shows launching Claude Code.
```bash
cd mindfly
claude
```
--------------------------------
### iOS Method Channel Setup (Swift)
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/advanced/method-channels.md
Imports and setup for a Method Channel in AppDelegate.swift. Ensure battery monitoring is enabled.
```swift
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let controller = window?.rootViewController as! FlutterViewController
let batteryChannel = FlutterMethodChannel(name: "com.example/device",
binaryMessenger: controller.binaryMessenger)
```
--------------------------------
### Install Gemini CLI MCP
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-designer/integrations/integrations.md
Install the Gemini CLI MCP using npm. This is a prerequisite for using Gemini as an integration.
```bash
npm install -g @google/gemini-cli
```
--------------------------------
### Install and Update CocoaPods
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/troubleshooting/google-play-store-deployment/error_running_pod_install.md
Ensures CocoaPods is installed and its repository definitions are up to date. Run these commands in your terminal.
```bash
sudo gem install cocoapods
```
```bash
pod repo update
```
--------------------------------
### Verify FVM Installation
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/adding-customization/vscode-extension.md
Checks if FVM is correctly installed and accessible by printing its version. This command should be run in the terminal after installation and PATH configuration.
```bash
fvm --version
```
--------------------------------
### Android Method Channel Setup (Kotlin)
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/advanced/method-channels.md
Imports required for setting up a Method Channel on the Android side. Ensure these are included in your MainActivity.
```kotlin
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import android.os.BatteryManager
import android.content.Context
```
--------------------------------
### Update Project YAML cURL Example
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/resources/projects/settings/project-apis.md
Provides a cURL example for updating multiple project YAML files simultaneously. It demonstrates updating `ad-mob` and `app-state` with their respective content.
```bash
curl -X POST \
'https://api.flutterflow.io/v2/updateProjectByYaml' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"projectId": "your-project-id",
"fileKeyToContent": {
"ad-mob": "showTestAds: false",
"app-state": "fields:\n - parameter:\n identifier:\n name: myAppState
key: hg7j8z0y
dataType:\n scalarType: String
description: \"Stores the current user session state\"
persisted: false\n - parameter:\n identifier:\n name: userPreferences
key: abc123xy
dataType:\n scalarType: JSON
description: \"User settings and preferences\"
persisted: true"
}
}'
```
--------------------------------
### Update App State Variable Example
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/resources/projects/settings/project-apis.md
This example demonstrates the workflow for updating an app state variable. It involves listing partition file names, downloading and modifying the project YAML, validating the changes, and finally updating the project.
```APIDOC
## Workflow for Updating App State Variable
### Description
This workflow outlines the steps to update an app state variable within a FlutterFlow project using the Project APIs. It includes checking for the existence of the `app-state` file, downloading, modifying, validating, and updating the project YAML.
### Steps
1. **Check for `app-state` file:** Use the `/listPartitionedFileNames` endpoint to verify if the `app-state` file exists.
2. **Download Project YAML:** If the file exists, call the `/projectYamls` endpoint to download the project's YAML content. This returns a base64-encoded zip file.
3. **Decode and Extract:** Decode the base64 string and extract the `app-state.yaml` file.
4. **Modify `app-state.yaml`:** Update the desired variable, for example, changing the `persisted` value of `enableDarkMode` to `true`.
5. **Escape and Validate:** Convert the modified YAML into a single-line, properly escaped string. Then, use the `/validateProjectYaml` endpoint to check for any syntax or configuration errors.
6. **Update Project:** If validation is successful, use the `/updateProjectByYaml` endpoint to send the final updated YAML content and apply the changes to the project.
```
--------------------------------
### Login API Response Example
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-integrations/authentication/firebase-auth/jwt-token-login.md
This is an example of a successful API response when a user logs in with valid credentials. It includes user details and JWT tokens for authentication.
```json
{
"user": {
"id": 1,
"role_id": 1,
"name": "james",
"email": "james@yopmail.com"
},
"token_type": "Bearer",
"expires_in": 3600,
"jwt_token": "eyJraWQiOiItSE5TUmtwMWdXcG9QcC1wWVBmU1U4UW1fdng4Q0VwdzRSdTZTQU9WLThRIiwiYWxnIjoiUlMyNTYifQ.eyJ2ZXIiOjEsImp0aSI6IkFULi1PaG5EdWREUG9qWklsZjMtVDRVWHlTWW5ERElHQ3dYTUdQcXk1c1JUbjAub2FydGh3ZmxpbzhZOVZJbHc0eDYiLCJpc3MiOiJodHRwczovL2Rldi00NTc5MzEub2t0YS5jb20vb2F1dGgyL2F1c2hkNGM5NVF0RkhzZld0NHg2IiwiYXVkIjoiYXBpIiwiaWF0IjoxNjU5MDAyOTQ5LCJleHAiOjE2NTkwMDY1NDksImNpZCI6IjBvYWhkaGprdXRhR2NJSzJNNHg2IiwidWlkIjoiMDB1aGVuaDFwVkRNZzJ1ZXg0eDYiLCJzY3AiOlsib2ZmbGluZV9hY2Nlc3MiXSwiYXV0aF90aW1lIjoxNjU5MDAyOTQ5LCJzdWIiOiJhcGktdXNlcjRAaXd0Lm5ldCJ9.g2TyTQECo-HCSjn58Fmazki8DBCtCq2hkG6OGQOJgr0JUq3uHgj8ulojoBI5ckv3e3TcVGFg1x9KknSwgiZo0LxRpbAdbF27hfF8truExjEv7hGKoV_oAOaiD56be5K-HjYkp6j-b5S6gXe4N10T1NtovLI7L6MZvmqCL_26qzXni5hNkCjgRm8Rd6GnJwbjDLpV3snp51bVNYNqhoAhOPBqjmOErFQvO2Wmfkj8DuVXzsvRqm_xfb8-7Oosx5oGVMVR3liXW5NZsRWes4TXXwsEou3qCyVy5fAhzm7rKjIk1zWv9vm0IOWMFwHHYTgEc_LTYWMovWtkuBx4ia546Q",
"refresh_token": "dlIOQHHAmweyOrVkDlpNYpi1XM-DwX5Cgx70LoKIbTI"
}
```
--------------------------------
### Example App-Level Action Block
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/generated-code/directory-structure.md
This is an example of an app-level Action Block, like 'addToWishlist', which is included in the 'actions.dart' file. It demonstrates how to add a product ID to a local wishlist and update the application state.
```dart
Future addToWishlist(
BuildContext context, {
required String? productId}) async {
// Add productId to wishlist object
FFAppState().addToLocalWishlist(productId!);
FFAppState().update(() {});
}
```
--------------------------------
### Deploy Staging Preview
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/README.md
Use these make commands to build the site and deploy it to a Firebase Hosting preview channel. You can specify a custom channel name and expiry duration.
```bash
make staging
make staging CHANNEL=my-channel
make staging CHANNEL=my-channel EXPIRES=14d
```
--------------------------------
### SOAP API Example Response
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/resources/control-flow/backend-logic/api/soap-api.md
This is an example of a SOAP API response, formatted in XML, detailing a match score.
```xml
Red Dragons
Silver Sharks
2-1
```
--------------------------------
### Initialize Workspace for Editing Existing Project
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/advanced/flutterflow-cli/flutterflow-mcp.md
When prompted for an existing project ID, provide it to bind the workspace to that project for editing. Press Enter to create a new app instead.
```bash
Existing project ID to edit (press Enter to create a new app)
> mindfly-c9lbgr
```
--------------------------------
### REST API Example Response
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/resources/control-flow/backend-logic/api/streaming-api.md
This is an example of a typical response from a REST API, where data is delivered in discrete chunks.
```json
{
"event": "match_score",
"data": {
"team1": "Red Dragons",
"team2": "Silver Sharks",
"score": "2-1"
}
}
```
--------------------------------
### Install Codex CLI MCP
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-designer/integrations/integrations.md
Install the Codex CLI MCP using npm. This is a prerequisite for using Codex as an integration.
```bash
npm install -g @openai/codex
```
--------------------------------
### List Project File Names Usage
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/resources/projects/settings/project-apis.md
Example of how to call the API to list file names using curl. Replace 'your-project-id' and 'YOUR_API_TOKEN' with actual values.
```bash
curl -X GET \
'https://api.flutterflow.io/v2/listPartitionedFileNames?projectId=your-project-id' \
-H 'Authorization: Bearer YOUR_API_TOKEN'
```
--------------------------------
### Example Prompt for Generating a Shader
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/animations/shaders.md
Use this prompt structure when asking AI models like ChatGPT or Claude to generate a Flutter-compatible GLSL .frag shader. Describe your desired effect clearly.
```text
Create a Flutter-compatible GLSL .frag shader for a soft animated onboarding background using Flutter runtime effect format. {describe your effect here} Return complete shader code and a downloadable .frag file.
```
--------------------------------
### Install Claude Code MCP
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-designer/integrations/integrations.md
Install the Claude Code MCP using npm. This is a prerequisite for using Claude as an integration.
```bash
npm install -g @anthropic-ai/claude-code
```
--------------------------------
### Android Background Thread Example (Kotlin)
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/advanced/method-channels.md
Example of how to execute a long-running operation on a background thread and return the result to Dart.
```kotlin
Thread(Runnable {
val resultData = longRunningOperation()
runOnUiThread {
result.success(resultData)
}
}).start()
```
--------------------------------
### Workspace Setup Wizard Prompts
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/advanced/flutterflow-cli/flutterflow-mcp.md
The interactive wizard prompts for workspace name, existing project ID, and API key. It also offers to register the FlutterFlow AI MCP server with detected coding CLIs.
```bash
Workspace name
Directory to scaffold the FlutterFlow AI workspace in.
> mindfly
```
```bash
Existing project ID to edit (press Enter to create a new app)
>
```
```bash
Register FlutterFlow AI MCP server with coding CLIs
Detected: claude, gemini, codex
Register with claude? [Y/n]
```
```bash
Ready to create:
Workspace: mindfly
Project ID: (none — unlinked)
API key: set (***abcd)
Base URL: https://api.flutterflow.io (built-in for prod)
MCP CLIs: claude, gemini, codex
Proceed? [Y/n]
```
--------------------------------
### Restrict App Installation to Specific Devices in AndroidManifest.xml
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/adding-customization/configuration-files.md
Specify hardware requirements using `` to ensure the app is only installed on compatible devices, such as those with a camera.
```xml
```
--------------------------------
### Install FVM Globally
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/adding-customization/vscode-extension.md
Installs Flutter Version Management (FVM) globally using Dart's package manager. This command is run in your terminal.
```bash
dart pub global activate fvm
```
--------------------------------
### Create a Custom Flutter Plugin
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/ff-concepts/advanced/method-channels.md
Use the Flutter CLI to initialize a new plugin project with support for Android and iOS platforms.
```bash
flutter create --template=plugin --platforms=android,ios my_custom_plugin
```
--------------------------------
### List Projects Usage
Source: https://github.com/flutterflow/flutterflow-documentation/blob/main/docs/resources/projects/settings/project-apis.md
Example curl command to list projects, including the request body and authorization header. Ensure to replace placeholders.
```bash
curl 'https://api.flutterflow.io/v2/l/listProjects' \
-H 'authorization: Bearer YOUR_API_TOKEN' \
--data-raw '{
"project_type": "ALL",
"deserialize_response": true
}'
```