首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Getx小部件运行时显示错误-Flutter

使用Getx小部件运行时显示错误-Flutter
EN

Stack Overflow用户
提问于 2021-02-22 17:56:18
回答 1查看 815关注 0票数 1

此错误仅在我使用get package时发生。为了解决这个问题,我从.pub-cache/hosted/pub.dartlang.org目标中删除了get文件夹,并再次导入了它,但什么也没有发生。

代码语言:javascript
复制
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...

/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:121:9: 
Error: Type 'RouteInformationProvider' not found.

final RouteInformationProvider routeInformationProvider;
^^^^^^^^^^^^^^^^^^^^^^^^

/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:122:9: Error: Type
'RouteInformationParser' not found.
final RouteInformationParser<Object> routeInformationParser;
^^^^^^^^^^^^^^^^^^^^^^

/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:122:9: Error:
Expected 0 type arguments.
final RouteInformationParser<Object> routeInformationParser;
^

/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:123:9: Error: Type
'RouterDelegate' not found.
final RouterDelegate<Object> routerDelegate;
^^^^^^^^^^^^^^

/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:123:9: Error:
Expected 0 type arguments.
final RouterDelegate<Object> routerDelegate;
^


/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_material_app.dart:130:9: Error:
Expected 0 type arguments.
final RouteInformationParser<Object> routeInformationParser;
^^^^^^^^^^^^^^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_material_app.dart:132:9: Error: '
BackButtonDispatcher' isn't a type.
final BackButtonDispatcher backButtonDispatcher;
^^^^^^^^^^^^^^^^^^^^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_material_app.dart:245:25: Error:
Method not found: 'MaterialApp.router'.
? MaterialApp.router(
^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\Flutter\packages\flutter_tools\gradle\flutter.gradle'
line: 896
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\bin\flutter.bat'' finished with non
-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --
info or --debug option to get more log output. Run with --scan to
get full insights.
* Get more help at https://help.gradle.org

BUILD FAILED in 22s
Exception: Gradle task assembleDebug failed with exit code 1

我使用了许多其他包,但只有在使用get包时才会出现错误。

EN

回答 1

Stack Overflow用户

发布于 2021-03-06 15:26:22

打开android演播室终端

1-清理你的项目

代码语言:javascript
复制
flutter clean 

2-将颤动通道更改为稳定

代码语言:javascript
复制
Flutter channels:
  master
  dev
  beta
* stable

确保你在一个稳定的频道上

3-现在您需要进行升级颤动升级(在终端上)

代码语言:javascript
复制
flutter upgrade 

输出

代码语言:javascript
复制
Flutter is already up to date on channel stable
Flutter 2.0.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c5a4b4029c (2 days ago) • 2021-03-04 09:47:48 -0800
Engine • revision 40441def69
Tools • Dart 2.12.0

4-再次保持干净

代码语言:javascript
复制
flutter clean 

如果你在flutter 2上,那么一切都很好:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66313417

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档