> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# circleci/flutter

Easily install Flutter SDK, package dependencies, run unit test, lint and more on CircleCI. Supports Linux and macOS


## 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


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |

### install_android_gradle_dependencies

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


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |
| `gradle_tool` | enum | ./gradlew | Which gradle executable to use |

### 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


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |

### install_ios_pod

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


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |
| `repo_update` | boolean | false | Whether to run 'pod install' with the '--repo-update' option. |

### install_pub

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


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |

### install_sdk

Install Flutter SDK


| Parameter | Type | Default | Description |
|---|---|---|---|
| `channel` | enum | stable | The release channel your version is in. |
| `install_location` | string | ~/usr/development | Install path for the Flutter binaries. |
| `version` | string | 3.32.7 | The target version for the Flutter SDK. |

### install_sdk_and_pub

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


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |
| `channel` | enum | stable | The release channel your version is in. |
| `install_location` | string | ~/development | Install path for the Flutter binaries. |
| `version` | string | 3.32.7 | The target version for the Flutter SDK. |

## Jobs

### lint

Run static analysis(flutter analyze)


| Parameter | Type | Default | Description |
|---|---|---|---|
| `analyze_dir` | string | lib | Path to the directory containing your Dart source code to analyze. |
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |
| `version` | string | 3.32.7 | The target version for the Flutter SDK. |

### unit_test

Run Unit Test


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | . | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |
| `version` | string | 3.32.7 | The target version for the Flutter SDK. |

## Examples

### install_for_android_machine

Install Flutter SDK and packages for Android machine executor


```yaml
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


```yaml
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)


```yaml
version: '2.1'
orbs:
  flutter: circleci/flutter@2.0
workflows:
  test:
    jobs:
      - flutter/lint:
          version: 3.32.7
```

### unit_test

Run Unit Test


```yaml
version: '2.1'
orbs:
  flutter: circleci/flutter@2.0
workflows:
  test:
    jobs:
      - flutter/unit_test:
          version: 3.32.7
```