I got the error (this one didn't bring the error screen for my run
web application, which I stumbled upon while inspecting the debug console) NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.messaging'
.
Here is my debug console:
NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.messaging'
packages/firebase_messaging_web/src/interop/messaging.dart 21:26 getMessagingInstance
packages/firebase_messaging_web/firebase_messaging_web.dart 28:27 get [_delegate]
packages/firebase_messaging_web/firebase_messaging_web.dart 109:5 getToken
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/firebase_messaging_web/firebase_messaging_web.dart 108:27 getToken
packages/firebase_messaging/src/messaging.dart 117:22 getToken
packages/hello_world/......
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/hello_world/......
packages/hello_world/...... <fn>
packages/riverpod/src/common.dart 524:24 <fn>
packages/riverpod/src/common.dart 283:16 map
packages/riverpod/src/common.dart 523:12 AsyncValueX.when
packages/hello_world/......
packages/flutter/src/widgets/framework.dart 4876:22 build
packages/flutter/src/widgets/framework.dart 4806:15 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 4883:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 4883:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5154:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5154:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 5825:32 updateChildren
packages/flutter/src/widgets/framework.dart 6375:17 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4977:11 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5009:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5154:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4977:11 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5009:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 6222:14 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5154:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 6222:14 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4977:11 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5009:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4977:11 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5009:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5154:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5154:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4977:11 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5009:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5154:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4977:11 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 5009:5 update
packages/flutter/src/widgets/framework.dart 3530:14 updateChild
packages/flutter/src/widgets/framework.dart 4832:16 performRebuild
packages/flutter/src/widgets/framework.dart 4977:11 performRebuild
packages/flutter/src/widgets/framework.dart 4529:5 rebuild
packages/flutter/src/widgets/framework.dart 2659:18 buildScope
packages/flutter/src/widgets/binding.dart 891:9 drawFrame
packages/flutter/src/rendering/binding.dart 370:5 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1146:15 [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1083:9 handleDrawFrame
packages/flutter/src/scheduler/binding.dart 997:5 [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1090:13 invoke
lib/_engine/engine/platform_dispatcher.dart 160:5 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 194:45 <fn>
dart-sdk/lib/async/zone.dart 1442:13 _rootRunUnary
dart-sdk/lib/async/zone.dart 1335:19 runUnary
dart-sdk/lib/async/zone.dart 1244:7 runUnaryGuarded
dart-sdk/lib/async/zone.dart 1281:26 <fn>
I googled and read some Stack Overflow questions, but their errors are not relevant to me. The last sentence in their error is not dart.global.firebase.messaging
.
How can I fix this error? Appreciate if someone can advise. Thank you in advance!
CodePudding user response:
I found a solution. When I updated firebase_messaging
to a newer version, this error went away!