21
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

flutter webのアプリをfirebase hostingで公開する

Last updated at Posted at 2019-05-08

事前準備

flutter webを動かせるところまでは下記等を参考に

flutter_web
flutter webでexampleを動かすまで(flutterインストール済みを想定)
Flutter Webを動かしたときにつまづいたこと

flutter webが動かせる状態で、tools-support-for-flutter-web-developmentを参考に新規プロジェクトを作成

プロダクションビルド

web/assets/FontManifest.jsonとして下記を準備
これがないと動かない?っぽい存在してないよって怒られるだけ

[
  {
    "family": "MaterialIcons",
    "fonts": [
      {
        "asset": "https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2"
      }
    ]
  }
]

下記でビルド

webdev build

ローカルで直接build/index.htmlを開いても動かない模様

スクリーンショット 2019-05-08 20.02.02.png

firebase hosting準備

firebaseでプロジェクト作成後、下記を実行

firebase init

firebase hostingを選択して下記のように設定

? What do you want to use as your public directory? build
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? File build/index.html already exists. Overwrite? No

デプロイ

firebase deploy

無事表示された

スクリーンショット 2019-05-08 20.18.07.png

リポジトリはこちら

おまけ

flutter webのアプリをgithub pagesで公開したやつ

関連

Flutter Web で Firestore を使うを書きました。

21
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?