我升级了flutter并运行了我的应用,但它无法启动并引发无效参数错误。
我尝试从开发者通道和主通道切换,并在终端上运行Flutter Doctor,但问题仍然存在。
Running "flutter pub get" in feedback... 1.0s
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
Syncing files to device Android SDK built for x86...
I/flutter ( 6956): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 6956): The following ArgumentError was thrown attaching to the render tree:
I/flutter ( 6956): Invalid argument(s)
I/flutter ( 6956): When the exception was thrown, this was the stack:
I/flutter ( 6956): #0 _StringBase.+ (dart:core-patch/string_patch.dart:260:57)
I/flutter ( 6956): #1 new _MainModel&Model&AuthModel&ResponsesModel (package:Feedback/scoped-models/main.dart:10:57)
I/flutter ( 6956): #2 new _MainModel&Model&AuthModel&ResponsesModel&UtilityModel (package:Feedback/scoped-models/main.dart)
I/flutter ( 6956): #3 new _MainModel&Model&AuthModel&ResponsesModel&UtilityModel&InternetModel (package:Feedback/scoped-models/main.dart)
I/flutter ( 6956): #4 new MainModel (package:Feedback/scoped-models/main.dart)
I/flutter ( 6956): #5 new MyAppState (package:Feedback/main.dart:23:27)
I/flutter ( 6956): #6 MyApp.createState (package:Feedback/main.dart:18:12)
I/flutter ( 6956): #7 new StatefulElement (package:flutter/src/widgets/framework.dart:3989:25)
I/flutter ( 6956): #8 StatefulWidget.createElement (package:flutter/src/widgets/framework.dart:802:38)
I/flutter ( 6956): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3082:40)
I/flutter ( 6956): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
I/flutter ( 6956): #11 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:939:16)
I/flutter ( 6956): #12 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:910:5)
I/flutter ( 6956): #13 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:856:17)
I/flutter ( 6956): #14 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2320:19)
I/flutter ( 6956): #15 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:855:13)
I/flutter ( 6956): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:736:7)
I/flutter ( 6956): #17 runApp (package:flutter/src/widgets/binding.dart:786:7)
I/flutter ( 6956): #18 main (package:Feedback/main.dart:12:16)
I/flutter ( 6956): #19 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:216:25)
I/flutter ( 6956): #24 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:208:5)
I/flutter ( 6956): #25 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
I/flutter ( 6956): #26 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
I/flutter ( 6956): (elided 4 frames from package dart:async)
I/flutter ( 6956): ════════════════════════════════════════════════════════════════════════════════════════════════════
D/EGL_emulation( 6956): eglMakeCurrent: 0xaa442fc0: ver 3 0 (tinfo 0x9fb5e310)
答案 0 :(得分:0)
正如之前在评论中指出的那样,建议运行 flutter clean
,因为它通常可以解决构建问题。该命令会清除项目的构建缓存,并尝试再次运行应用程序应该重建项目并可能清除所有问题。但在这种情况下,您似乎发现原因是别的。
展望未来,为人们提供一个 minimal repro 以便能够复制给定的问题也将有所帮助。