我在运行
时遇到问题flutter pub run build_runner build --delete-conflicting-outputs
该命令不会出错,但会卡在第一个文件中
WARNING] No actions completed for 15.0s, waiting on:
- auto_route_generator:autoRouteGenerator on lib/ui/shared/ui_helpers.dart
- auto_route_generator:autoRouteGenerator on lib/ui/views/settings/settings_datamodel.dart
- auto_route_generator:autoRouteGenerator on lib/ui/views/settings/settings.dart
- auto_route_generator:autoRouteGenerator on lib/ui/views/review_invitation/review_invitation_datamodel.dart
- auto_route_generator:autoRouteGenerator on lib/ui/views/review_invitation/review_invitation.dart
.. and 9 more
[INFO] 1m 17s elapsed, 1/15 actions completed.
以下是我的发布规范:
dependencies:
flutter:
sdk: flutter
# see below for explanation
stacked_services:
auto_route:
stacked: ^1.7.6
stacked_hooks: 0.1.1+3
flutter_hooks:
get_it:
injectable:
validators: ^2.0.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
auto_route_generator:
injectable_generator:
虽然这是我的router.dart的类
import 'package:auto_route/auto_route_annotations.dart';
import 'package:myapp/ui/views/StartupView.dart';
@MaterialAutoRouter(
routes: <AutoRoute>[
MaterialRoute(page: StartupView, initial: true),
],
)
class $Router {}
有什么建议吗?
答案 0 :(得分:5)
一个flutter pub upgrade
解决了我的问题。
答案 1 :(得分:1)
方法1::如果在发生升级混乱之后,请尝试运行:
flutter packages upgrade
然后flutter pub run build_runner build
方法2:,这为我解决了问题:
1- flutter clean
2-删除所有* .g.dart(如果存在)
3-进入开发频道:flutter channel dev
4-升级:flutter upgrade --force
5- flutter pub get
6-尝试构建:flutter pub run build_runner build
7-回到稳定频道或主频道:flutter channel stable
(flutter channel master
)
8-升级:flutter upgrade --force
答案 2 :(得分:0)
如果有人遇到同样的问题,请尝试将 Flutter 从 v1.20.1 升级到 v1.20.2
答案 3 :(得分:0)
确保您的项目名称不包含“%20”个字符。这会导致任何构建方法(例如 flutter packages pub run build_runner build --delete-conflicting-outputs
和 flutter pub run build_runner clean
)失败。