万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

Flutterでなぜかチャンネルがdevにならない

なぜかstableなチャンネルしかない。

> flutter channel
Flutter channels:
* stable

どうやっても切り替わらない・・。

flutter channel dev

Flutterブランチでこれでもだめ

git fetch --prune
> flutter upgrade --force
Flutter is already up to date on channel stable
Flutter 1.17.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f21edf8b6 (3 days ago) • 2020-05-28 12:44:12 -0700
Engine • revision b851c71829
Tools • Dart 2.8.3
> flutter channel dev
Switching to flutter channel 'dev'...
git: fatal: 'origin/dev' is not a commit and a branch 'dev' cannot be created from it
Switching channels failed with error code 128.

https://stackoverflow.com/questions/54381620/error-when-trying-to-run-flutter-upgrade

これも試してもだめ。

git clean -xfd
git stash save --keep-index
git stash drop
git pull

結果

Removing bin/cache/
Removing packages/flutter_tools/.dart_tool/
Removing packages/flutter_tools/.packages
Removing packages/flutter_tools/pubspec.lock
Removing version
No local changes to save
No stash entries found.
Already up to date.

もしかすると最初これで落としたのかも?

git clone https://github.com/flutter/flutter.git -b stable --depth 1

うまく動いてるやつの.git/config設定を見ると

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = https://github.com/flutter/flutter.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "stable"]
        remote = origin
        merge = refs/heads/stable
[branch "beta"]
        remote = origin
        merge = refs/heads/beta

もしかしてfetchの設定かも?

[remote "origin"]
        url = https://github.com/flutter/flutter.git
        # fetch = +refs/heads/stable:refs/remotes/origin/stable
        # こうする
        fetch = +refs/heads/*:refs/remotes/origin/*

Flutter Webでログイン

Flutter 1.9以降で認証プロバイダーとしてGoogleを使ったFirebaseログインを実装する - Qiita

この記事が一番かも?

以下のはpubspec.yamlになくてもいけた。

  googleapis_auth: 0.2.10

新しい設定

  googleapis_auth: 0.2.10
  firebase: 5.0.4
  firebase_auth: ^0.16.1

へ置き換え。

web/index.html は以下の通りにしたよ

  <script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-app.js"></script>
  <script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-auth.js"></script>
  <script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-firestore.js"></script>