인프런 커뮤니티 질문&답변

word high님의 프로필 이미지
word high

작성한 질문수

[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!

Authentication 마무리하기

Go router v7 적용후 에러

해결된 질문

작성

·

798

1

안녕하세요 코드팩토리님 Authentication 마무리하기 강의를 듣는도중 실행해보니 크게 2가지 에러가 발생했습니다ㅠFlutterError.demangleStackTrace 관련 오류와 DioException [bad response]: The request returned an invalid status code of 401: 아래는 에러 전문입니다. await storage.deleteAll을 해볼까 싶다가도 어디에 삽입해야 작동이될지 몰라서 한번 여쭤보겠습니다! Performing hot restart...

Syncing files to device iPhone 14 Pro...

Restarted application in 467ms.

flutter: [REQ] [GET] http://127.0.0.1:3000/user/me/

======== 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 180 pos 7: 'line != '===== asynchronous gap ===========================''

The relevant error-causing widget was:

UncontrolledProviderScope UncontrolledProviderScope:file:///Users/idohyeong/.pub-cache/hosted/pub.dev/flutter_riverpod-2.3.6/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:180:7)

#3 MappedIterator.moveNext (dart:_internal/iterable.dart:393:20)

#4 WhereTypeIterator.moveNext (dart:_internal/iterable.dart:871: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:47:28)

#8 Iterable.toList (dart:core/iterable.dart:497:7)

#9 StackFrame.fromStackString (package:flutter/src/foundation/stack_frame.dart:82:10)

#10 StackFrame.fromStackTrace (package:flutter/src/foundation/stack_frame.dart:68:12)

#11 FlutterErrorDetails.debugFillProperties (package:flutter/src/foundation/assertions.dart:714:57)

#12 DiagnosticableNode.builder.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:2891:17)

#13 DiagnosticableNode.builder (package:flutter/src/foundation/diagnostics.dart:2894:8)

#14 _FlutterErrorDetailsNode.builder (package:flutter/src/foundation/assertions.dart:1290:56)

#15 DiagnosticableNode.emptyBodyDescription (package:flutter/src/foundation/diagnostics.dart:2905:77)

#16 DiagnosticsNode.toJsonMap.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:1621:13)

#17 DiagnosticsNode.toJsonMap (package:flutter/src/foundation/diagnostics.dart:1650:6)

#18 WidgetInspectorService._nodeToJson (package:flutter/src/widgets/widget_inspector.dart:1714:18)

#19 WidgetInspectorService._reportStructuredError (package:flutter/src/widgets/widget_inspector.dart:967:44)

#20 FlutterError.reportError (package:flutter/src/foundation/assertions.dart:1185:14)

#21 _reportException (package:flutter/src/widgets/framework.dart:6807:16)

#22 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5385:9)

#23 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5541:11)

#24 Element.rebuild (package:flutter/src/widgets/framework.dart:5092:7)

#25 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5358:5)

#26 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5532:11)

#27 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5352:5)

... Normal element mounting (7 frames)

#34 UncontrolledProviderScopeElement.mount (package:flutterriverpod/src/framework.dart:309:11)

... Normal element mounting (35 frames)

#69 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4231:16)

#70 Element.updateChild (package:flutter/src/widgets/framework.dart:3742:18)

#71 RawViewElement.updateChild (package:flutter/src/widgets/view.dart:289:16)

#72 _RawViewElement.mount (package:flutter/src/widgets/view.dart:312:5)

... Normal element mounting (7 frames)

#79 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4231:16)

#80 Element.updateChild (package:flutter/src/widgets/framework.dart:3742:18)

#81 RootElement._rebuild (package:flutter/src/widgets/binding.dart:1299:16)

#82 RootElement.mount (package:flutter/src/widgets/binding.dart:1268:5)

#83 RootWidget.attach.<anonymous closure> (package:flutter/src/widgets/binding.dart:1221:18)

#84 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2733:19)

#85 RootWidget.attach (package:flutter/src/widgets/binding.dart:1220:13)

#86 WidgetsBinding.attachToBuildOwner (package:flutter/src/widgets/binding.dart:1065:27)

#87 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:1047:5)

#88 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:1033:7)

#92 RawReceivePort.handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

(elided 5 frames from class AssertionError, class Timer, and dart:async-patch)

====================================================================================================

flutter: [ERR] [GET] http://127.0.0.1:3000/user/me/

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: DioException [bad response]: The request returned an invalid status code of 401.

#0 DioMixin.fetch.<anonymous closure> (package:dio/src/dio_mixin.dart:533:7)

#1 FutureListener.handleError (dart:async/futureimpl.dart:177:22)

#2 Future._propagateToListeners.handleError (dart:async/future_impl.dart:855:47)

#3 Future._propagateToListeners (dart:async/future_impl.dart:876:13)

#4 Future._completeError (dart:async/future_impl.dart:652:5)

#5 SyncCompleter.completeError (dart:async/future_impl.dart:63:12)

#6 Completer.completeError (dart:async/futureimpl.dart:27:5)

#7 Future.any.onError (dart:async/future.dart:618:45)

#8 _RootZone.runBinary (dart:async/zone.dart:1666:54)

#9 FutureListener.handleError (dart:async/futureimpl.dart:174:22)

#10 Future._propagateToListeners.handleError (dart:async/future_impl.dart:855:47)

#11 Future._propagateToListeners (dart:async/future_impl.dart:876:13)

<…>

======== 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 180 pos 7: 'line != '===== asynchronous gap ===========================''

The relevant error-causing widget was:

ProviderScope ProviderScope:file:///Users/idohyeong/Desktop/authentication_practice/lib/main.dart:11:5

When the exception was thrown, this was the stack:

#2 StackFrame.fromStackTraceLine (package:flutter/src/foundation/stack_frame.dart:180:7)

#3 MappedIterator.moveNext (dart:_internal/iterable.dart:393:20)

#4 WhereTypeIterator.moveNext (dart:_internal/iterable.dart:871: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:47:28)

#8 Iterable.toList (dart:core/iterable.dart:497:7)

#9 StackFrame.fromStackString (package:flutter/src/foundation/stack_frame.dart:82:10)

#10 StackFrame.fromStackTrace (package:flutter/src/foundation/stack_frame.dart:68:12)

#11 FlutterErrorDetails.debugFillProperties (package:flutter/src/foundation/assertions.dart:714:57)

#12 DiagnosticableNode.builder.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:2891:17)

#13 DiagnosticableNode.builder (package:flutter/src/foundation/diagnostics.dart:2894:8)

#14 _FlutterErrorDetailsNode.builder (package:flutter/src/foundation/assertions.dart:1290:56)

#15 DiagnosticableNode.emptyBodyDescription (package:flutter/src/foundation/diagnostics.dart:2905:77)

#16 DiagnosticsNode.toJsonMap.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:1621:13)

#17 DiagnosticsNode.toJsonMap (package:flutter/src/foundation/diagnostics.dart:1650:6)

#18 WidgetInspectorService._nodeToJson (package:flutter/src/widgets/widget_inspector.dart:1714:18)

#19 WidgetInspectorService._reportStructuredError (package:flutter/src/widgets/widget_inspector.dart:967:44)

#20 FlutterError.reportError (package:flutter/src/foundation/assertions.dart:1185:14)

#21 _reportException (package:flutter/src/widgets/framework.dart:6807:16)

#22 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5385:9)

#23 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5541:11)

#24 Element.rebuild (package:flutter/src/widgets/framework.dart:5092:7)

#25 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5358:5)

#26 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5532:11)

#27 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5352:5)

#28 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4231:16)

#29 Element.updateChild (package:flutter/src/widgets/framework.dart:3736:20)

#30 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5401:16)

#31 Element.rebuild (package:flutter/src/widgets/framework.dart:5092:7)

#32 ProxyElement.update (package:flutter/src/widgets/framework.dart:5707:5)

#33 Element.updateChild (package:flutter/src/widgets/framework.dart:3720:15)

#34 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5401:16)

#35 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5541:11)

#36 Element.rebuild (package:flutter/src/widgets/framework.dart:5092:7)

#37 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2793:19)

#38 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:966:21)

#39 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:457:5)

#40 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1301:15)

#41 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1231:9)

#42 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:954:7)

#46 RawReceivePort.handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

(elided 5 frames from class AssertionError, class Timer, and dart:async-patch)

====================================================================================================

 

답변 3

1

코드팩토리님의 프로필 이미지
코드팩토리
지식공유자

안녕하세요!

401에러는 토큰 상태가 잘못된 상태입니다.

혹시 storage 문제라고 생각되신다면 에뮬레이터에서 앱을 완전 삭제한 후 다시 실행해보세요!

그래도 안되면 다시 질문 부탁드립니다.

감사합니다!

0

word high님의 프로필 이미지
word high
질문자

https://github.com/puretension/authentication_practice.git 연습해보는 프로젝트 링크입니다ㅠㅠ main함수에 router를 적용함과동시에 에러가 터져서 도저히 해결이 안되서 올리겠습니다ㅜ봐주시면 정말 감사하겠습니다!

코드팩토리님의 프로필 이미지
코드팩토리
지식공유자

안녕하세요. SplashScreen.routeName을 두번 선언하셔서 버그 난거였습니다. 라우트 이름은 한 프로젝트당 하나만 존재 할 수 있고 유니크 해야합니다. 감사합니다!

word high님의 프로필 이미지
word high
질문자

헐 이런실수를ㅠㅠㅠ해결했습니다! 주의하겠습니다ㅎㅎ 감사합니다!!!

0

word high님의 프로필 이미지
word high
질문자

삭제하고 해봤는데도 안되네요 ㅠㅠ 이미 완성된 코드팩토리님프로젝트는 실행해보니 또 됩니다. Go Router적용전에까지가 하나 있어서 이걸로 하나씩 다시 추가해보며 다시해보겠습니다! 답변 감사합니다!

word high님의 프로필 이미지
word high

작성한 질문수

질문하기