Making flutter builds faster


I’ve set up a flutter build and all is working fine for both iOS and Android. I was hoping to make the build a bit faster by leveraging caching. However, my attempts so far have just slowed things down. That’s because despite caching, the steps I was hoping would be faster (such as installing flutter) are still the same. That is, they’re not using the cache to avoid the need to re-install.

Is there any guidance on setting up flutter with Bitrise in such a way as to avoid the ~3 mins required to simply install flutter on every build?

For the record, I tried caching these paths:

  • /Users/vagrant/flutter/
  • /Users/vagrant/.pub-cache/
  • /usr/local/Cellar/
  • /Users/vagrant/Library/Caches/Homebrew/

However, that was far too expensive (~4GB) and was recreating the cache every time due to irrelevant file changes. I also tried toning it right down to just:

  • /Users/vagrant/flutter/

The cache was still approaching 1GB and it would have been faster, except flutter still insisted on running a full install. My install script for flutter is:

    - script:
        title: Install flutter
        - content: |-
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # debug log
            set -x

            cd ..
            git clone -b alpha
            export PATH=`pwd`/flutter/bin:$PATH

            brew install --HEAD libimobiledevice
            brew install ideviceinstaller
            brew install ios-deploy

            flutter doctor



Hi @ch_kent,

Are you sure that’s where flutter installs its actual binaries? bin/flutter in the repository is just a script ( Not sure where the actual binary is / what should be cached. That always depends on the tool, what worth to cache and which dir(s) should be cached.

Additionally, if most of the flutter install is downloading some pre-compiled binaries then the cache might not even worth it at all, as the cache have to be downloaded as well, which will most likely take about the same time than just downloading from the official source. E.g. brew by default downloads precompiled tools, meaning brew install usually can’t be made faster as it just downloads the binaries/components.

Typically the best candidates for caching are the files/dirs which you can’t just download from an official source but have to be built locally. There you trade the compile time for cache download, which usually is faster, but this also depends on the tool, how fast or slow the compile of the tool is vs the size of the compiled files.

I’m not saying flutter can’t be cached, just wanted to share a couple of notes / things to consider. Unfortunately we’re not familiar with how flutter install works (what would worth or not worth to cache), you might want to ask that on flutter’s forums/support.

Of course if you’d have any questions just let us know! :slight_smile:

Another option to speed up Flutter installation process is to include Flutter SDK in the Bitrise stacks. Beta and dev versions are available as archives. Linux version is ~300 MB, macOS one about 600 MB.


This is just what I need. I was planning to do the same but just not time.

Is there a repo to show off how to do this ?

The caching idea will really help

How frequently the SDKs are updated? Also, does it matter which version is available, similar to e.g. the Android NDK?

Dev versions are released every few days. Beta theoretically - every few weeks (Flutter build release channels · flutter/flutter Wiki · GitHub) but it does not match reality.

No, in beta and dev channels you can download whichever version you want at anytime. Only in master channel there are no version numbers.

So pre-installing Dev versions wouldn’t help much, right? Even for Beta versions I’m not that sure, as we do the updates once a week, so if they release Betas frequently there’s a significant chance that it won’t be the right version for your project, right? I mean it will be either newer or older than the version you develop with but most likely not the exact same version, right?

Yep, it seems that we should wait for release version.

1 Like

Flutter have stable version now, and stable versions will be released every quarter, so it is not every week. Let reconsider faster builds.
Current “Flutter Install” step takes over 2 minutes for every builds, so it is better to add Flutter to stacks.

We generally intend to roll the stable branch every quarter or so, probably with more fanfare than a regular beta roll.
Release process · flutter/flutter Wiki · GitHub

1 Like

Hy, thanks for the heads up, I will talk to the developers in charge of this :upside_down_face:

UPDATE: We already have the card to add flutter to the hybrid stack, so it will be available soon :upside_down_face:


Thanks! I’m really looking forward to use the new stack! :upside_down_face:

1 Like

Is there any update on this?

It still takes about 180 seconds to install Flutter on Hybrid stack and no other is available at the moment.

Also, without setting version manually to v1.2.1 it takes more than 5-6 mins to install Flutter stable channel utilizing this workaround.

It means that it’s impossible to build even basic Flutter app on free plan.

If you add Firebase to the iOS app it takes almost 30 minutes to complete initial flutter build and then again 20 minutes to archive .ipa. So in other words it’s impossible to build iOS Flutter app with Firebase on Developer plan.

This is very unpleasant experience as Bitrise is being promoted as mobile focused CI platform.

1 Like

I’m sad to hear you have these hardships, it is kind of hard to make it faster, because this is how flutter works, and it is out of our reach, we are currently trying to find a solution to cache flutter builds so that part could be faster.

Flutter is already installed on current macOS stacks. So we can reduce a time by skipping “Flutter Install” step on Workflow.
Thanks for adding Flutter to macOS stacks!


Hey guys I see the Stack but it’s not been updated for a long time so it’s now outdated.

Hi, the stack is updated to 1.9.1+hotfix.6 now. We can send Pull Request to osx-box-bootstrap repository, if updates are needed.

1 Like

Hey @viktorbenei i was wondering if you could take a look at my issues:

I seem to have my flutter deployment running continuously but i do not know what the issues are, i was wondering if a second eyes could take a look at it.

I’m having this exact issue, I am very curious if the build speed is quicker after caches are created. Sadly my builds aborts at 45 minutes and the bitrise cache push step is never reached, so I will never know. Its incredibly frustrating “flutter-build” step takes about 60 seconds locally (macbook pro 16 inch) and 32 minutes on the build server. Thats 32 times slower :sweat_smile:

Information regarding my project:

Bare bone project with a firebase integration, here are the dependencies I’m using.

cloud_firestore: ^0.14.0+2
firebase_core: ^0.5.0
sign_in_with_apple: ^2.5.2
firebase_auth: ^0.18.0+1

“flutter-installer” takes ~ 2 minutes and downloads Flutter v1.17.1

Edit: This seems like a firebase specific issue, one with a solution outlined in the following github issue.

I can confirm my build times have been greatly reduced after following the instructions in that github issue



1 Like

@viktorbenei check:

They do some hotfix releases montly or so, but for mayor versions they take more than that.

I believe that it will be really valuable to have that in bitrise, specialy on flutter because we build iOS and android and removing time in the middle will help the CI process a lot.


Generally we do not have hot fixes or release candidates install on the stack in order to provide a stable environment for the majority of users. If you do need a hotfix release you can easily install it during your build.