Closed davidsomekh closed 1 year ago
Flutter doctor report:
flutter doctor -v [β] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19045.2486], locale en-GB) β’ Flutter version 3.3.8 on channel stable at C:\flutter β’ Upstream repository https://github.com/flutter/flutter.git β’ Framework revision 52b3dc25f6 (3 months ago), 2022-11-09 12:09:26 +0800 β’ Engine revision 857bd6b74c β’ Dart version 2.18.4 β’ DevTools version 2.15.0
[β] Android toolchain - develop for Android devices (Android SDK version 30.0.3) β’ Android SDK at C:\Users\david.somekh\AppData\Local\Android\sdk β’ Platform android-33, build-tools 30.0.3 β’ ANDROID_HOME = C:\Users\david.somekh\AppData\Local\Android\sdk β’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java β’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) β’ All Android licenses accepted.
[β] Chrome - develop for the web β’ Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[β] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.2.0) β’ Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional β’ Visual Studio Professional 2022 version 17.2.32505.173 β’ Windows 10 SDK version 10.0.19041.0
[β] Android Studio (version 4.2) β’ Android Studio at C:\Program Files\Android\Android Studio β’ Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter β’ Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart β’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[β] VS Code (version 1.74.3) β’ VS Code at C:\Users\david.somekh\AppData\Local\Programs\Microsoft VS Code
[β] Connected device (3 available) β’ Windows (desktop) β’ windows β’ windows-x64 β’ Microsoft Windows [Version 10.0.19045.2486] β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 109.0.5414.76 β’ Edge (web) β’ edge β’ web-javascript β’ Microsoft Edge 109.0.1518.61
[β] HTTP Host Availability β’ All required HTTP hosts are available
β’ No issues found! PS C:\apps\keep> flutter doctor -v [β] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19045.2486], locale en-GB) β’ Flutter version 3.3.8 on channel stable at C:\flutter β’ Upstream repository https://github.com/flutter/flutter.git β’ Framework revision 52b3dc25f6 (3 months ago), 2022-11-09 12:09:26 +0800 β’ Engine revision 857bd6b74c β’ Dart version 2.18.4 β’ DevTools version 2.15.0
[β] Android toolchain - develop for Android devices (Android SDK version 30.0.3) β’ Android SDK at C:\Users\david.somekh\AppData\Local\Android\sdk β’ Platform android-33, build-tools 30.0.3 β’ ANDROID_HOME = C:\Users\david.somekh\AppData\Local\Android\sdk β’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java β’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) β’ All Android licenses accepted.
[β] Chrome - develop for the web β’ Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[β] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.2.0) β’ Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional β’ Visual Studio Professional 2022 version 17.2.32505.173 β’ Windows 10 SDK version 10.0.19041.0
[β] Android Studio (version 4.2) β’ Android Studio at C:\Program Files\Android\Android Studio β’ Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter β’ Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart β’ Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[β] VS Code (version 1.74.3) β’ VS Code at C:\Users\david.somekh\AppData\Local\Programs\Microsoft VS Code β’ Flutter extension version 3.58.0
[β] Connected device (3 available) β’ Windows (desktop) β’ windows β’ windows-x64 β’ Microsoft Windows [Version 10.0.19045.2486] β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 109.0.5414.76 β’ Edge (web) β’ edge β’ web-javascript β’ Microsoft Edge 109.0.1518.61
[β] HTTP Host Availability β’ All required HTTP hosts are available
β’ No issues found!
Additionally, I added the service worker code as explained here: https://firebase.flutter.dev/docs/messaging/usage/
@davidsomekh This document link is archive and not updated anymore. Can you try https://firebase.google.com/docs/cloud-messaging/flutter/client#web, follow the instructions from there and see if they help in your case ?
@darshankawar
Yes, I tried also the setup with these instructions - same result.
Here is my pubspec.yaml:
cupertino_icons: ^1.0.2 firebase_auth: ^4.1.2 google_sign_in: ^5.0.3 firebase_core: ^2.2.0 shared_preferences: ^2.0.16 flutter_local_notifications: ^9.3.1 cloud_firestore: ^4.0.5 font_awesome_flutter: ^10.2.1 provider: ^6.0.4 cloud_functions: ^4.0.7 rxdart: ^0.27.7 firebase_messaging: ^14.2.1
Thanks for the update. I tried with plugin example and uploaded to firebase hosting which worked properly without any issues. Can you try the same ? Looking at the error, it seems to be a config issue rather than the plugin, because it is unable to register the said method.
Running flutter clean solved the problem - you can close the issue
I am trying to implement FCM for a flutter web project.
When I run the project in the localhost, it works fine. But when I upload it to firebase hosting (After running flutter build web), I am getting errors.
On the main.dart file, I am trying to get the device token:
However, I am getting this error in the console:
main.dart.js:4430 Uncaught MissingPluginException(No implementation found for method Messaging#getToken on channel plugins.flutter.io/firebase_messaging)
I added the firebase messaging package in my pubspec.yaml file:
firebase_messaging: ^14.2.1
Additionally, I added the service worker code as explained here: https://firebase.flutter.dev/docs/messaging/usage/
Here is my index.html script code:
It looks like a problem with the firebase_messaging package, but I'm using the latest one. Also what I can't understand is why it's working in localhost but not production.
Thoughts anyone?