How to implement GitHub Actions for Flutter Application

Implement GitHub actions for Flutter application. Automation in flutter app.

Automation is necessary now a days, here I am talking about project development. Every time we add new feature, we run our test case and build application. We can automate this process with help of GitHub Actions for Flutter. Here I am sharing yml file details for one of application. This will process every commit and check test and buildable app after that commit.

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
  # Triggers the workflow on push or pull request events but only for the "master" branch
    branches: [ "master" ]
    branches: [ "master" ]

  # Allows you to run this workflow manually from the Actions tab

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
  # This workflow contains a single job called "build"
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v1
          java-version: '12.x'
      - uses: subosito/flutter-action@v2
          flutter-version: '3.0.5'
          channel: 'stable'
      - run: flutter pub get
      - run: flutter test
      - run: flutter build apk
      - run: flutter build appbundle

Let me explain what it will do.


name: CI

This will define name for workflow.


This specifies what operation we need to do. We have specified Push and pullRequest operation on master branch(please check in code).


This defines what to do when particular action happens. This line will run our action on ubuntu :

runs-on: ubuntu-latest

Actions which need to perform when our actual work starts is defined by below lines : 

uses: actions/checkout@v3

uses: actions/setup-java@v1

We can also specify particular version also, like we have specified for java and flutter. 

Once all setup done. We are able to run commands, which we run in our terminal to update pub or get pub. You can see in ending section.

Note : This file will be created withing .github/workflows directory with .yml file extension. This file is formatted in intended format, so be careful when editing this file.


Thank you for reading this post, please share your experience also. 

Share this content:


More Posts

How does data persistence work in Android?

Data persistence in Android is the ability to save data to the device so that it can be accessed later, even if the app is closed or the device is restarted. There are several ways to achieve data persistence in Android

Fragments and Activities: Two Pillars of Android Development

Fragments and Activities are both important components of Android development. Fragments are a good choice for creating reusable and dynamic UIs, while Activities are a good choice for managing the lifecycle of an app’s UI and implementing core features.

Table of Contents

Send Us A Message