/flutter_web_firebase_hosting

Short sample and instructions for configuring a Flutter Web application to deploy-on-push to Firebase Hosting

Primary LanguageHTML

Sample hosted at flutterweb-101.web.app.

  1. Creat a Flutter web project
flutter create --platforms=web .
  1. Create a Firebase project

  2. Enable hosting

    • Click on "Hosting" on the left navigation (on the Firebase project page)
    • Follow the instructions to install the Firebase CLI tools (if you don't already have them installed).
    • When running firebase init, choose Hosting and GitHub Action deploys.
    • When going through the configuration, set "public" to build/web.
    • Change the build command to flutter build web.
  3. Update .github/workflows for Flutter

    • Update the two generated firebase-hosting- files to include Flutter setup:
    steps:
       # This has to come before `flutter bulid web`
       - uses: subosito/flutter-action@v2.2.1
       with:
          # Defining the channel is optional - I'm using beta
          channel: beta
          # Setting cache is also optional, although this does speed up builds!
          cache: true
       - uses: actions/checkout@v2