LoginSignup
6
6

More than 1 year has passed since last update.

【Flutter】バージョンを意図的に下げる

Posted at

現在のバージョンを確認する

当時の最新版(3.3.8)で環境構築をしていたら、実はバージョンが低い環境が必要とのことで、Flutter SDKのバージョンを下げることになりました。
ちなみに環境は、Intel Mac(Macbook Pro)でOSはVentura13.0.1です。

% flutter --version
Flutter 3.3.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 52b3dc25f6 (3 weeks ago) • 2022-11-09 12:09:26 +0800
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0

downgradeコマンド

調べてみると、downgradeというコマンドがあるようなのですが、私の環境では以下の通り。

% flutter downgrade 2.10.3
There is no previously recorded version for channel "stable".

エラーとなってしまったので、もうちょっとWebを捜索してみると、SDKのディレクトリでGitから取得しろとの情報が。

Gitの出番

なるほどね、と思って以下のようにやって、バージョンを下げました。

% pwd
/Users/ユーザー名/Development/flutter ← SDKのインストールディレクトリ

% git fetch
remote: Enumerating objects: 130, done.
remote: Counting objects: 100% (122/122), done.
remote: Total 130 (delta 121), reused 121 (delta 121), pack-reused 8
Receiving objects: 100% (130/130), 179.82 KiB | 19.98 MiB/s, done.
Resolving deltas: 100% (121/121), completed with 70 local objects.
From https://github.com/flutter/flutter
   ff59250dbe..2703a2bcde  main       -> origin/main
   ff59250dbe..2703a2bcde  master     -> origin/master
 * [new branch]            revert-115009-fix_linux_remapped_capslock_throws -> origin/revert-115009-fix_linux_remapped_capslock_throws

% git tag
0.0.10
0.0.11
0.0.12
0.0.13

〜 割愛 〜

2.10.02.10.0-0.0.pre
2.10.0-0.1.pre
2.10.0-0.2.pre
2.10.0-0.3.pre
2.10.1
2.10.2
2.10.3
2.10.4
2.10.5
2.11.0-0.1.pre
2.12.0-4.0.pre

% git checkout 2.10.3 ← 戻したいバージョンを指定してチェックアウト
Updating files: 100% (3492/3492), done.
Note: switching to '2.10.3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 7e9793dee1 [flutter_releases] Flutter stable 2.10.3 Framework Cherrypicks (#99337)

% flutter --version
Downloading Dart SDK from Flutter engine bd539267b42051b0da3d16ffa8f48949dce8aa8f...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  209M  100  209M    0     0  41.8M      0  0:00:04  0:00:04 --:--:-- 42.7M
Building flutter tool...
Flutter 2.10.3 • channel unknown • unknown source
Framework • revision 7e9793dee1 (9 months ago) • 2022-03-02 11:23:12 -0600
Engine • revision bd539267b4
Tools • Dart 2.16.1 • DevTools 2.9.2

% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 2.10.3, on macOS 13.0.1 22A400 darwin-x64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

という感じで無事にダウングレードすることができました。
あんまり使うことはないかも知れませんが、結局はGitからチェックアウトするのが王道のようですね。
参考になれば幸いです。

6
6
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
6
6