Skip to content

Automatically updates the Dart SDK version in your pubspec.yaml to match the Dart version bundled with the installed Flutter SDK. Ensures Flutter and Dart versions are always compatible and prevents CI build errors due to version mismatches.

License

Notifications You must be signed in to change notification settings

IamPekka058/flutter-dart-sync

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter-dart-sync

GitHub Super-Linter CI Check dist/ CodeQL Coverage

[!NOTE] This action currently pins the Dart SDK to the exact version bundled with the installed Flutter SDK (for example: environment: sdk: "3.1.0"). It does not generate or maintain version ranges (for example: ">=3.1.0 <4.0.0"). You can auto commit the changes using the GitHub App integration if desired.

Inputs

Name Description Required Default
pubspec_path Path to the pubspec.yaml file. true ./pubspec.yaml
fail_if_flutter_not_installed Whether to fail the action if the Flutter SDK is not installed. false false
commit_changes If true, attempt to commit the updated pubspec.yaml using GitHub App. false false
commit_message Commit message to use when committing changes (required if commit_changes is true). 📌 Sync Dart SDK version with Flutter ``
gh_app_id GitHub App ID (required for committing via the GitHub App flow). false ``
gh_installation_id GitHub App installation ID (required for committing via the GitHub App). false ``
gh_private_key GitHub App private key (PEM) used to authenticate the App. false ``

Usage

To use this action in your workflow, add the following step. It's recommended to place it after you have checked out your code and set up the Flutter SDK.

name: CI

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          flutter-version: '3.16.0' # Example version

      - name: Sync Dart SDK version with Flutter
        uses: IamPekka058/flutter-dart-sync@v1
        with:
          pubspec_path: './pubspec.yaml'
          fail_if_flutter_not_installed: true

      # Add subsequent steps like flutter pub get, build, test, etc.
      - name: Install Dependencies
        run: flutter pub get
- name: Sync Dart and commit via GitHub App
  uses: IamPekka058/flutter-dart-sync@v1
  with:
    pubspec_path: './pubspec.yaml'
    commit_changes: true
    commit_message: 'chore: sync Dart SDK with Flutter'
    gh_app_id: ${{ secrets.GH_APP_ID }}
    gh_installation_id: ${{ secrets.GH_INSTALLATION_ID }}
    gh_private_key: ${{ secrets.GH_PRIVATE_KEY }}

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Automatically updates the Dart SDK version in your pubspec.yaml to match the Dart version bundled with the installed Flutter SDK. Ensures Flutter and Dart versions are always compatible and prevents CI build errors due to version mismatches.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •