FlutterFlow CLI
The FlutterFlow CLI tool allows you to quickly and easily download your project files directly from FlutterFlow to your local machine.
Installation
To use the FlutterFlow CLI, you first need to install it globally using Dart's package manager with the following command:
dart pub global activate flutterflow_cli
Usage
Follow the steps below to export your project.
API Token
To use the CLI, you'll need to create an API token and use it in your requests. See the documentation here on how to generate an API token.
CLI command details
-
If you wish to exclude assets from the download, use
-no-include-assets
in your command. This will download the project code without the assets. For example:flutterflow export-code --project your_project_id --dest path_to_output_folde --no-include-assets --token your_token
-
You can download code from a specific branch by switching to that branch and using the toolbar command, or by including the
-branch-name
or-b
flag in your command and specifying the branch you wish to download from.
All supported command options
Flag | Behavior | Default |
---|---|---|
--dest / -d | Specifies a destination folder other than the current directory. | Current directory |
--[no]-include-assets | Option to download assets (images, GIFs). Useful for consecutive code exports if the assets folder hasn't changed. | False |
--branch-name / -b | Downloads from a specific branch. | Main |
--[no]-fix | Option to run dart fix on the code after downloading. | False |
--[no]-parent-folder | Option to download the code into a subfolder instead of directly into the directory. | False |
--[no]-as-module | Whether to generate the project as a Flutter module. | False |
--[no]-as-debug | Whether to generate the project with debug logging to be able to use FlutterFlow Debug Panel inside the DevTools. | False |
--project-environment | Which development environment to be used. If empty, the current environment in the project will be downloaded. | Current environment |
Filtered exports
If you are updating an existing project and do not want certain files to be overwritten during a code export, you can create a .flutterflowignore
file in the root of your project directory. This file should contain a list of files to be ignored using globbing syntax.
Example:
If your project is located at:
/Users/yourname/projects/my_flutterflow_app/
Then, place the .flutterflowignore
file in:
/Users/yourname/projects/.flutterflowignore
Example .flutterflowignore
contents:
my_flutterflow_app/android/app/build.gradle # Prevents FlutterFlow from overwriting native Android build configuration
my_flutterflow_app/ios/Runner/Info.plist # Keeps iOS app metadata unchanged
my_flutterflow_app/web/index.html # Ensures custom modifications to the web entry file are retained
This ensures that the specified files and directories are not overwritten during code export.
For more details on globbing syntax, refer to this guide.
FAQ
I am getting an error as FormatException: Missing argument for…
This error likely indicates that you haven't correctly entered the command option along with its value. Double-check that all required information has been entered. If everything is correct and you're still encountering the error, it might be due to using an outdated version of the FlutterFlow CLI. To resolve this, you can update to the latest version by running the installation command:
dart pub global activate flutterflow_cli
This should update the CLI and fix the issue.