flutter - 如何成功构建 Flutter Gallery 应用程序?
问题描述
我尝试构建 Flutter 的 Gallery 应用程序并得到两次相同的错误。你能帮我建造它吗?注意:我跑了
flutter run -d macos
这是错误:
lib/demos/material/picker_demo.dart:23:9: Error: Type 'RestorableTimeOfDay' not found.
final 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'。返回 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
推荐阅读
- github - 是否可以删除 GitHub 包版本,然后用新版本替换它
- ios - 在 ios 应用程序(如 facebook)中打开任意 http 页面
- python - 什么可能导致 -->TypeError: float() 参数必须是字符串或数字,而不是“方法”
- htmx - 定居在 HTMX
- kubernetes - Kubernetes pod fluentd 转发到 fluentd DaemonSet
- lint - 有人知道如何修复 StandardJS Linter 错误吗?
- c - ctypes 结构奇怪的行为?
- google-cloud-platform - 如何将每个用户的请求始终分配给实例组中的同一个实例?
- python - 将 html 代码/变量从 Flask 发送到 HTML
- python - 测试中的更改未拉入应用程序上下文