flutter-buildpack-heroku

by AndersonOli

GitHub Readme.md

Heroku Buildpack for Flutter

header Automate your deployments on Heroku easily.

🔨 Setup

Add this Buildpack in your Heroku app

In dashboard:

You can copy the link of this repository and paste it in buildpacks or write diezep/flutter and will be added automatically.

In Heroku CLI:

$ heroku buildpacks:set diezep/flutter -a <Heroku App name>

Optional

You can add optional environment variables to customize the deployment of your project but nothing is required, all are optional.

Problems to compile

By default, this buildpack get the last version of Flutter automatically, sometimes because is on beta channel, that version may have problems to compile a project with web support in cloud services.

If this is your case, you can try downgrade the Flutter version manually, add FLUTTER_VERSION variable in your Heroku environment with the number of the version that are currently working web support.

🚩 TODO :

Environment variables :

  • VERSION to set the name of custom version of Flutter.
  • CLEANUP to remove uneccessary files after the build.
  • CACHE to remove and download every file its need to compile the project in every deploy.
  • SUBDIR to ubicate the project if it isn't in a root directory.

Features :

  • No more PHP Buildpack needed.
  • Save and restore Flutter and Dart SDK in cache.
  • Save and restore dhttpd in cache.
  • Save and restore project dependencies needed in cache.

🚧 Environment variables:

All variables were built following the structure FLUTTER_VARNAME to identified easily in Heroku configurations. If you want to use some variable, remember use the structure following to the variable.

Variable Type Default Description CLEANUP boolean true Remove uneccessary files of your project after the compile. VERSION string Last version in beta channel. The name of the version you want to use to compile the project.

Set variable

Example of setting CLEANUP var in Heroku CLI:

$ heroku config:set FLUTTER_CLEANUP=true -a project-name

Example

The next image is an example of setting environment variables following the structure mentioned above :

example_use_in_variables

📝 Final note

This buildpack is unofficial that means i don't have any conection with Heroku or Google from Flutter developer team . This repository was made as a hobby, i'm always interested in learn new things, this is one demostration of that :)