簡體   English   中英

如何成功構建 Flutter Gallery 應用程序?

[英]How can I successfully build the Flutter Gallery app?

我嘗試構建 Flutter 的 Gallery 應用程序並得到兩次相同的錯誤。 你能幫我建造它嗎? 注意:我跑了

flutter run -d macos

這是錯誤:

lib/demos/material/picker_demo.dart:23:9: Error: Type 'RestorableTimeOfDay' not found.

最終 RestorableTimeOfDay _fromTime = RestorableTimeOfDay(
^^^^^^^^^^^^^^^^^^^
lib/demos/material/picker_demo.dart:23:9:錯誤:“RestorableTimeOfDay”不是一種類型。 最終 RestorableTimeOfDay _fromTime = RestorableTimeOfDay(
^^^^^^^^^^^^^^^^^^^
lib/demos/material/picker_demo.dart:23:41:錯誤:找不到方法:'RestorableTimeOfDay'。 最終 RestorableTimeOfDay _fromTime = RestorableTimeOfDay(
^^^^^^^^^^^^^^^^^^^
lib/demos/material/picker_demo.dart:88:16:錯誤:找不到方法:'TimePickerDialog'。 返回時間選擇器對話框(

謝謝你的幫助

錯誤是由於我在穩定頻道上

$ flutter channel
Flutter channels:
  master
  dev
  beta
* stable

如 github 頁面所示,必須使用主通道。

$ flutter channel master
Switching to flutter channel 'master'...
git: From https://github.com/flutter/flutter
git:  + f9c825981c...fa5883b78e dev            -> origin/dev  (forced update)
git:  * [new branch]            flutter-2.3-candidate.19 -> origin/flutter-2.3-candidate.19
git:  * [new branch]            flutter-2.3-candidate.20 -> origin/flutter-2.3-candidate.20
git:  * [new branch]            flutter-2.3-candidate.21 -> origin/flutter-2.3-candidate.21
git:  * [new branch]            flutter-2.3-candidate.22 -> origin/flutter-2.3-candidate.22
git:    58ac7b85d9..811f0d9a15  master         -> origin/master
git:  * [new tag]               2.3.0-16.0.pre -> 2.3.0-16.0.pre
git: Switched to a new branch 'master'
git: Branch 'master' set up to track remote branch 'master' from 'origin'.
Successfully switched to flutter channel 'master'.
To ensure that you're on the latest build from this channel, run 'flutter upgrade'

$ flutter upgrade
Downloading Dart SDK from Flutter engine 03d645e782db18812d33a843f61c7b220f3db107...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  216M  100  216M    0     0  8057k      0  0:00:27  0:00:27 --:--:-- 8515k
Building flutter tool...
Flutter is already up to date on channel master
Flutter 2.3.0-17.0.pre.223 • channel master • https://github.com/flutter/flutter.git
Framework • revision 811f0d9a15 (4 hours ago) • 2021-06-04 22:14:03 -0700
Engine • revision 03d645e782
Tools • Dart 2.14.0 (build 2.14.0-182.0.dev)

$ flutter channel
Downloading package sky_engine...                                  883ms
Downloading flutter_patched_sdk tools...                           977ms
Downloading flutter_patched_sdk_product tools...                   616ms
Downloading linux-x64 tools...                                      3.8s
Downloading linux-x64/font-subset tools...                         562ms
Flutter channels:
* master
  dev
  beta
  stable

現在它運行:

$ flutter run
Downloading linux-x64/linux-x64-flutter-gtk tools...             2,750ms
Downloading linux-x64-profile/linux-x64-flutter-gtk tools...      1,810ms
Downloading linux-x64-release/linux-x64-flutter-gtk tools...      2,001ms
Running "flutter pub get" in gallery...                          2,791ms
Launching lib/main.dart on Linux in debug mode...
Building Linux application...                                           
Syncing files to device Linux...                                   635ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM