Error: Method not found: 'guardWebExceptions' 'Error.throwWithStackTrace' convertPlatformException 에러 해결 방법

Asked 4 months ago, Updated 4 months ago, 182 views

Flutter 앱을 웹에서 실행할 때 아래와 같이 에러가 발생합니다.

**/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_web-2.2.8/lib/src/internals.dart:11:10: Error: Method not found: 'guardWebExceptions'. return internals.guardWebExceptions( ^^^^^^^^^^^^^^^^^^

 

 /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11:

Error: Method not found: 'Error.throwWithStackTrace'. Error.throwWithStackTrace(exception, stackTrace); ^^^^^^^^^^^^^^^^^^^

 

 /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9:

Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace( ^^^^^^^^^^^^^^^^^^^

 

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7:

Error: A non-null value must be returned since the return type 'Never' doesn't allow null. Never convertPlatformException(Object exception, StackTrace stackTrace) { ^ Failed to compile application.**

flutter

2022-05-26 16:55

2 Answers

저도 같은 문제가 있었는데 아래처럼 해결했습니다.

pubspeck.yaml에 다음과 같은 내용을 넣었습니다.

dependency_overrides:
  firebase_messaging_platform_interface: 3.1.6


2022-05-26 16:56

Flutter Firebase 패키지의 dependency에 대한 변경 사항이 있습니다.

https://github.com/FirebaseExtended/flutterfire/pull/8156

2.16.0 버전의 dart나 더 최신 버전을 사용하도록 업데이트 하면 됩니다.

또는 dependency를 재정의하려면 사용 중인 dependency만 추가하면 됩니다.

dependency_overrides:
  firebase_messaging_platform_interface: 3.1.6
  firebase_storage_platform_interface: 4.0.14
  cloud_functions_platform_interface: 5.0.21
  cloud_firestore_platform_interface: 5.4.13
  firebase_auth_platform_interface: 6.1.11
  firebase_database_platform_interface: 0.2.0+5


2022-05-26 16:58

If you have any answers or tips


© 2022 pinfo. All rights reserved.