Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

事前準備

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で公開したやつ

https://hiko1129.github.io/first_flutter_web/

関連

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

hiko1129
開発なんでも屋 Flutterが好きな気がしている
https://note.hiko1129.com/
game8
ゲーム攻略メディア「Game8」の運営をメイン事業に、ライフスタイルメディア運営、動画配信事業、広告事業を展開しています。
https://game8.co.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした