1

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)

  • I am using firebase_messaging to handle push notification
  • when my app going to the background and push notification arrives, that time onBackgroundMessage method call and this error occurred
  • I have already tried many solutions which are related to this issue but still, I am facing this issue
  • here is my onBackgroundMessage method code
Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) {
  print("myBackgroundMessageHandler: $message");
  if (message.containsKey('data')) {
    // Handle data message
    final dynamic data = message['data'];
    print("myBackgroundMessageHandler: $message");
    var emailMessageId = message['data']['message_id'];
      SharedPreferences prefs = await SharedPreferences.getInstance();
}
  • I am getting this error when getting SharedPreferences instance
Hinal Halvadia
  • 236
  • 2
  • 6
  • 1
    i this you added SharedPreferences package while app was running and you did not give full restart to app. because of that you may face this error. so stop you app and again run you app. – Viren V Varasadiya Apr 30 '20 at 10:03
  • my app is already running and then I put the App into the background – Hinal Halvadia Apr 30 '20 at 11:09
  • Does this answer your question? [Flutter: Unhandled exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared\_preferences)](https://stackoverflow.com/questions/50687801/flutter-unhandled-exception-missingpluginexceptionno-implementation-found-for) – Petrus Nguyễn Thái Học Mar 01 '21 at 07:52

0 Answers0