Start Building for Free
CircleCI.comBlogCommunitySupport

circleci/flutter

A shareable package of CircleCI configuration to integrate with flutter, written by circleci

Certified
  1. Orbs
  2. circleci/flutter@3.0.0

circleci/flutter@3.0.0

Certified
Sections
Easily install Flutter SDK, package dependencies, run unit test, lint and more on CircleCI. Supports Linux and macOS
Created: June 22, 2020Version Published: July 30, 2025Releases: 10
Org Usage:
247
Homepage:
https://flutter.dev
Source:
https://github.com/CircleCI-Public/flutter-orb

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: flutter: circleci/flutter@3.0.0

Use flutter elements in your existing workflows and jobs.

Usage Examples

install_for_android_machine

Install Flutter SDK and packages for Android machine executor

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 version: '2.1' orbs: android: circleci/android@1.0.3 flutter: circleci/flutter@2.0.0 jobs: distribute: executor: name: android/android-machine steps: - flutter/install_sdk_and_pub: channel: stable version: 3.32.7 - flutter/install_android_gradle_dependencies - flutter/install_android_gem - run: command: bundle exec fastlane distribute working_directory: ios workflows: distribute: jobs: - distribute

install_for_macos

Install Flutter SDK and packages for macOS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 version: '2.1' orbs: flutter: circleci/flutter@2.0.0 jobs: distribute: macos: xcode: 12.5.1 steps: - flutter/install_sdk_and_pub: channel: stable version: 3.32.7 - flutter/install_ios_pod - flutter/install_ios_gem - run: command: bundle exec fastlane distribute working_directory: ios workflows: distribute: jobs: - distribute

lint

Run static analysis(flutter analyze)

1 2 3 4 5 6 7 8 version: '2.1' orbs: flutter: circleci/flutter@2.0 workflows: test: jobs: - flutter/lint: version: 3.32.7

unit_test

Run Unit Test

1 2 3 4 5 6 7 8 version: '2.1' orbs: flutter: circleci/flutter@2.0 workflows: test: jobs: - flutter/unit_test: version: 3.32.7

Jobs

lint

Run static analysis(flutter analyze)

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
analyze_dir
Path to the directory containing your Dart source code to analyze.
Path to the directory containing your Dart source code to analyze.
No
lib
type: string
string
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string
version
The target version for the Flutter SDK.
The target version for the Flutter SDK.
No
3.32.7
type: string
string

unit_test

Run Unit Test

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string
version
The target version for the Flutter SDK.
The target version for the Flutter SDK.
No
3.32.7
type: string
string

Commands

install_android_gem

Install your Android Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string

install_android_gradle_dependencies

Install your Android gradle packages with automated caching and best practices applied. Requires build.gradle or build.gradle.kts file.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string
gradle_tool
Which gradle executable to use
Which gradle executable to use
No
./gradlew
type: enum
enum

install_ios_gem

Install your iOS Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string

install_ios_pod

Install your iOS cocoapods packages with automated caching and best practices applied. Requires lock file.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string
repo_update
Whether to run 'pod install' with the '--repo-update' option.
Whether to run 'pod install' with the '--repo-update' option.
No
false
type: boolean
boolean

install_pub

Install your flutter packages with automated caching and best practices applied. Requires lock file.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string

install_sdk

Install Flutter SDK

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
channel
The release channel your version is in.
The release channel your version is in.
No
stable
type: enum
enum
install_location
Install path for the Flutter binaries.
Install path for the Flutter binaries.
No
~/usr/development
type: string
string
version
The target version for the Flutter SDK.
The target version for the Flutter SDK.
No
3.32.7
type: string
string

install_sdk_and_pub

Install Flutter SDK and your flutter packages with automated caching and best practices applied. Requires lock file.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app_dir
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
No
.
type: string
string
cache_version
Change the default cache version if you need to clear the cache for any reason.
Change the default cache version if you need to clear the cache for any reason.
No
v1
type: string
string
channel
The release channel your version is in.
The release channel your version is in.
No
stable
type: enum
enum
install_location
Install path for the Flutter binaries.
Install path for the Flutter binaries.
No
~/development
type: string
string
version
The target version for the Flutter SDK.
The target version for the Flutter SDK.
No
3.32.7
type: string
string

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | Easily install Flutter SDK, package dependencies, run unit test, lint and more on CircleCI. Supports Linux and macOS display: home_url: https://flutter.dev source_url: https://github.com/CircleCI-Public/flutter-orb commands: install_android_gem: description: | Install your Android Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd parameters: app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string steps: - restore_cache: keys: - bundle-<<parameters.cache_version>>-android-{{ checksum "<< parameters.app_dir >>/android/Gemfile.lock" }} - run: command: | bundle config set path ./vendor/bundle bundle install name: Install Dependencies working_directory: <<parameters.app_dir>>/android - save_cache: key: bundle-<<parameters.cache_version>>-android-{{ checksum "<< parameters.app_dir >>/android/Gemfile.lock" }} paths: - <<parameters.app_dir>>/android/vendor/bundle install_android_gradle_dependencies: description: | Install your Android gradle packages with automated caching and best practices applied. Requires build.gradle or build.gradle.kts file. parameters: app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string gradle_tool: default: ./gradlew description: Which gradle executable to use enum: - gradle - ./gradlew type: enum steps: - run: command: | if [ -f "<< parameters.app_dir >>/android/app/build.gradle" ]; then md5sum << parameters.app_dir >>/android/app/build.gradle > ~/gradle_cache_key else md5sum << parameters.app_dir >>/android/app/build.gradle.kts > ~/gradle_cache_key fi name: Calculate cache key - restore_cache: key: gradle-<<parameters.cache_version>>-{{ checksum "~/gradle_cache_key" }} - run: command: <<parameters.gradle_tool>> androidDependencies name: Installing Android gradle packages working_directory: << parameters.app_dir >>/android - save_cache: key: gradle-<<parameters.cache_version>>-{{ checksum "~/gradle_cache_key" }} paths: - ~/.gradle/caches - ~/.gradle/wrapper install_ios_gem: description: | Install your iOS Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd parameters: app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string steps: - restore_cache: keys: - bundle-<<parameters.cache_version>>-ios-{{ checksum "<< parameters.app_dir >>/ios/Gemfile.lock" }} - run: command: | bundle config set path ./vendor/bundle bundle install name: Install Dependencies working_directory: <<parameters.app_dir>>/ios - save_cache: key: bundle-<<parameters.cache_version>>-ios-{{ checksum "<< parameters.app_dir >>/ios/Gemfile.lock" }} paths: - <<parameters.app_dir>>/ios/vendor/bundle install_ios_pod: description: | Install your iOS cocoapods packages with automated caching and best practices applied. Requires lock file. parameters: app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string repo_update: default: false description: Whether to run 'pod install' with the '--repo-update' option. type: boolean steps: - restore_cache: keys: - pod-<<parameters.cache_version>>-{{ checksum "<< parameters.app_dir >>/ios/Podfile.lock" }} - run: command: pod install <<#parameters.repo_update>>--repo-update<</parameters.repo_update>> name: Install Dependencies working_directory: <<parameters.app_dir>>/ios - save_cache: key: pod-<<parameters.cache_version>>-{{ checksum "<< parameters.app_dir >>/ios/Podfile.lock" }} paths: - <<parameters.app_dir>>/ios/Pods install_pub: description: | Install your flutter packages with automated caching and best practices applied. Requires lock file. parameters: app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string steps: - restore_cache: keys: - pub-<<parameters.cache_version>>-{{ checksum "<< parameters.app_dir >>/pubspec.lock" }}-{{ arch }} - run: command: flutter pub get name: Install Dependencies working_directory: <<parameters.app_dir>> - save_cache: key: pub-<<parameters.cache_version>>-{{ checksum "<< parameters.app_dir >>/pubspec.lock" }}-{{ arch }} paths: - <<parameters.app_dir>>/.dart_tool install_sdk: description: | Install Flutter SDK parameters: channel: default: stable description: The release channel your version is in. enum: - stable - beta type: enum install_location: default: ~/usr/development description: Install path for the Flutter binaries. type: string version: default: 3.32.7 description: The target version for the Flutter SDK. type: string steps: - restore_cache: keys: - flutter-<<parameters.version>>-{{ arch }} - run: command: "#!/usr/bin/env bash\n\nINSTALL_LOCATION=$(eval \"echo $ORB_EVAL_INSTALL_LOCATION\")\n\nfunction install_flutter() {\n local machine=${1:-\"Linux\"}\n local arch=${2:-\"amd64\"}\n\n [[ $machine == \"Darwin\" ]] && uname=macos || uname=linux\n [[ $arch =~ \"arm64\" ]] && version=\"flutter_${uname}_arm64\" || version=\"flutter_${uname}\"\n [[ $uname == \"linux\" ]] && suffix=\"tar.xz\" || suffix=\"zip\"\n\n baseurl=\"https://storage.googleapis.com/flutter_infra_release/releases/$ORB_VAL_FLUTTER_RELEASE_CHANNEL\"\n fullurl=\"$baseurl/$uname/${version}_$ORB_VAL_FLUTTER_SDK_VERSION-$ORB_VAL_FLUTTER_RELEASE_CHANNEL.${suffix}\"\n\n curl -o \"flutter_sdk.${suffix}\" \"$fullurl\"\n\n mkdir -p $INSTALL_LOCATION\n \n if [ $suffix == \"tar.xz\" ]; then\n tar xf flutter_sdk.tar.xz -C \"$INSTALL_LOCATION\"\n else\n unzip -oqq flutter_sdk.zip -d \"$INSTALL_LOCATION\"\n fi\n\n rm -f \"flutter_sdk.${suffix}\"\n}\n\necho \"export PATH=$INSTALL_LOCATION/flutter/bin:\\$PATH\" >> \"$BASH_ENV\"\n# shellcheck source=/dev/null\nsource \"$BASH_ENV\"\n\nif ! command -v flutter &> /dev/null; then\n install_flutter \"$(uname)\" \"$(uname -m)\"\n echo \"Flutter installed at: $(eval command -v flutter)\"\nelse\n echo \"Previous Flutter installation detected: $(eval command -v flutter)\"\nfi\n" environment: ORB_EVAL_INSTALL_LOCATION: <<parameters.install_location>> ORB_VAL_FLUTTER_RELEASE_CHANNEL: <<parameters.channel>> ORB_VAL_FLUTTER_SDK_VERSION: <<parameters.version>> name: Install Flutter SDK if it does not exists - run: command: flutter doctor name: Run flutter doctor - save_cache: key: flutter-<<parameters.version>>-{{ arch }} paths: - <<parameters.install_location>> install_sdk_and_pub: description: | Install Flutter SDK and your flutter packages with automated caching and best practices applied. Requires lock file. parameters: app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string channel: default: stable description: The release channel your version is in. enum: - stable - beta type: enum install_location: default: ~/development description: Install path for the Flutter binaries. type: string version: default: 3.32.7 description: The target version for the Flutter SDK. type: string steps: - install_sdk: channel: <<parameters.channel>> install_location: <<parameters.install_location>> version: <<parameters.version>> - install_pub: app_dir: <<parameters.app_dir>> cache_version: <<parameters.cache_version>> jobs: lint: description: | Run static analysis(flutter analyze) docker: - image: ghcr.io/cirruslabs/flutter:<<parameters.version>> parameters: analyze_dir: default: lib description: Path to the directory containing your Dart source code to analyze. type: string app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string version: default: 3.32.7 description: The target version for the Flutter SDK. type: string steps: - checkout - install_pub: app_dir: <<parameters.app_dir>> cache_version: <<parameters.cache_version>> - run: command: flutter analyze <<parameters.analyze_dir>> name: Run static analysis working_directory: <<parameters.app_dir>> unit_test: description: | Run Unit Test docker: - image: ghcr.io/cirruslabs/flutter:<<parameters.version>> parameters: app_dir: default: . description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. type: string cache_version: default: v1 description: Change the default cache version if you need to clear the cache for any reason. type: string version: default: 3.32.7 description: The target version for the Flutter SDK. type: string steps: - checkout - install_pub: app_dir: <<parameters.app_dir>> cache_version: <<parameters.cache_version>> - run: command: flutter test name: Run Unit Test working_directory: <<parameters.app_dir>> examples: install_for_android_machine: description: | Install Flutter SDK and packages for Android machine executor usage: version: "2.1" orbs: android: circleci/android@1.0.3 flutter: circleci/flutter@2.0.0 jobs: distribute: executor: name: android/android-machine steps: - flutter/install_sdk_and_pub: channel: stable version: 3.32.7 - flutter/install_android_gradle_dependencies - flutter/install_android_gem - run: command: bundle exec fastlane distribute working_directory: ios workflows: distribute: jobs: - distribute install_for_macos: description: | Install Flutter SDK and packages for macOS usage: version: "2.1" orbs: flutter: circleci/flutter@2.0.0 jobs: distribute: macos: xcode: 12.5.1 steps: - flutter/install_sdk_and_pub: channel: stable version: 3.32.7 - flutter/install_ios_pod - flutter/install_ios_gem - run: command: bundle exec fastlane distribute working_directory: ios workflows: distribute: jobs: - distribute lint: description: | Run static analysis(flutter analyze) usage: version: "2.1" orbs: flutter: circleci/flutter@2.0 workflows: test: jobs: - flutter/lint: version: 3.32.7 unit_test: description: | Run Unit Test usage: version: "2.1" orbs: flutter: circleci/flutter@2.0 workflows: test: jobs: - flutter/unit_test: version: 3.32.7
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.