작성
·
2.3K
·
수정됨
0
안녕하세요, 시간이 없어 어떻게든 꾸역꾸역 듣고 있는데도 많은 도움을 얻고 있습니다.
_App 클래스에서 MaterialApp 위젯을 .router 생성자로 부르고 _App 클래스가 ConsumerWidget를 상속 받게끔 코드를 고치니 에러가 발생합니다.
가장 위에 보이는 에러는 이렇습니다.
다시 ConsumerWidget에서 StatelessWidget을 상속 받게 하니 에러는 발생하지 않습니다. .router 생성자를 빼도 에러가 발생하는 것을 보아 리버팟과 관련된 이슈인 듯 합니다.
저는 강의가 나온 후 조금 지난 시점에 듣기 시작해서 이미 리버팟이 2.1.대 버전일 때 시작했는데 강의와 시차가 있어 발생하는 문제일까요?
강사님 아니더라도 해결하신 분이 있다면 조언 부탁드립니다.
감사합니다.
에러 메시지 및 스택은 다음과 같습니다.
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 2609 pos 20: '_debugCurrentBuildTarget == context': is not true.
#0 AssertionError.doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 AssertionError.throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 BuildOwner.buildScope.<anonymous closure> (package:flutter/src/widgets/framework.dart:2609:20)
#3 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2613:12)
#4 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1110:13)
#5 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:945:7)
#6 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:925:7)
#7 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#8 Timer.runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#9 _Ti<…>
======== Exception caught by widgets library =======================================================
The following assertion was thrown building UncontrolledProviderScope:
Got a stack frame from package:stack_trace, where a vm or web frame was expected. This can happen if FlutterError.demangleStackTrace was not set in an environment that propagates non-standard stack traces to the framework, such as during tests.
'package:flutter/src/foundation/stack_frame.dart':
Failed assertion: line 192 pos 7: 'line != '===== asynchronous gap ===========================''
The relevant error-causing widget was:
UncontrolledProviderScope UncontrolledProviderScope:file:///Users/letmebelazy/Development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_riverpod-2.1.1/lib/src/framework.dart:250:12
When the exception was thrown, this was the stack:
#2 StackFrame.fromStackTraceLine (package:flutter/src/foundation/stack_frame.dart:192:7)
#3 MappedIterator.moveNext (dart:_internal/iterable.dart:391:20)
#4 WhereTypeIterator.moveNext (dart:_internal/iterable.dart:869:20)
#5 new GrowableList.ofOther (dart:core-patch/growable_array.dart:202:26)
#6 new GrowableList.of (dart:core-patch/growablearray.dart:152:26)
#7 new List.of (dart:core-patch/array_patch.dart:51:28)
#8 Iterable.toList (dart:core/iterable.dart:470:12)
#9 StackFrame.fromStackString (package:flutter/src/foundation/stack_frame.dart:93:10)
#10 StackFrame.fromStackTrace (package:flutter/src/foundation/stack_frame.dart:78:12)
#11 FlutterErrorDetails.debugFillProperties (package:flutter/src/foundation/assertions.dart:712:57)
#12 DiagnosticableNode.builder.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:2940:17)
#13 DiagnosticableNode.builder (package:flutter/src/foundation/diagnostics.dart:2943:8)
#14 _FlutterErrorDetailsNode.builder (package:flutter/src/foundation/assertions.dart:1289:56)
#15 DiagnosticableNode.emptyBodyDescription (package:flutter/src/foundation/diagnostics.dart:2954:77)
#16 DiagnosticsNode.toJsonMap.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:1632:13)
#17 DiagnosticsNode.toJsonMap (package:flutter/src/foundation/diagnostics.dart:1661:6)
#18 WidgetInspectorService._nodeToJson (package:flutter/src/widgets/widget_inspector.dart:1606:18)
#19 WidgetInspectorService._reportStructuredError (package:flutter/src/widgets/widget_inspector.dart:937:44)
#20 FlutterError.reportError (package:flutter/src/foundation/assertions.dart:1184:14)
#21 _debugReportException (package:flutter/src/widgets/framework.dart:6493:16)
#22 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4887:9)
#23 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#24 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#25 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4859:5)
#26 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5041:11)
#27 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4853:5)
... Normal element mounting (7 frames)
#34 UncontrolledProviderScopeElement.mount (package:flutterriverpod/src/framework.dart:309:11)
... Normal element mounting (9 frames)
#43 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16)
#44 Element.updateChild (package:flutter/src/widgets/framework.dart:3592:18)
#45 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1195:16)
#46 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1164:5)
#47 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1111:18)
#48 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2605:19)
#49 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1110:13)
#50 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:945:7)
#51 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:925:7)
(elided 6 frames from class AssertionError, class RawReceivePortImpl, class _Timer, and dart:async-patch)
====================================================================================================
======== Exception caught by widgets library =======================================================
The following assertion was thrown building ProviderScope(state: ProviderScopeState#5859c):
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4606 pos 14: 'owner!._debugCurrentBuildTarget == this': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was:
ProviderScope ProviderScope:file:///Users/letmebelazy/StudioProjects/code_factory/lib/main.dart:9:5
When the exception was thrown, this was the stack:
#2 Element.rebuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:4606:14)
#3 Element.rebuild (package:flutter/src/widgets/framework.dart:4609:6)
#4 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4859:5)
#5 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4853:5)
#6 UncontrolledProviderScopeElement.mount (package:flutterriverpod/src/framework.dart:309:11)
... Normal element mounting (9 frames)
#15 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16)
#16 Element.updateChild (package:flutter/src/widgets/framework.dart:3592:18)
#17 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1195:16)
#18 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1164:5)
#19 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1111:18)
#20 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2605:19)
#21 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1110:13)
#22 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:945:7)
#23 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:925:7)
(elided 6 frames from class AssertionError, class RawReceivePortImpl, class _Timer, and dart:async-patch)
====================================================================================================
======== Exception caught by widgets library =======================================================
The following assertion was thrown attaching to the render tree:
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4606 pos 14: 'owner!._debugCurrentBuildTarget == this': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
When the exception was thrown, this was the stack:
#2 Element.rebuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:4606:14)
#3 Element.rebuild (package:flutter/src/widgets/framework.dart:4609:6)
#4 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4859:5)
#5 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5041:11)
#6 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4853:5)
#7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16)
#8 Element.updateChild (package:flutter/src/widgets/framework.dart:3592:18)
#9 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1195:16)
#10 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1164:5)
#11 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1111:18)
#12 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2605:19)
#13 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1110:13)
#14 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:945:7)
#15 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:925:7)
(elided 6 frames from class AssertionError, class RawReceivePortImpl, class _Timer, and dart:async-patch)
====================================================================================================
답변 4
0
0
우습게도 고라우트 객체 내에 routes에 들어가는 또 다른 고라우트 객체 패스가 /로 시작한다는 이유였습니다. 코드팩토리님께 고라우터 버전을 바꿔보란 얘기를 듣고 바꿔보니 그제서야 해당 에러가 뜨더라구요. 해당 에러를 처리하고 다시 고라우터 버전을 최신으로 올렸는데도 잘 돌아갑니다.
0
0