I have been going at this problem for almost half a day now. I am trying to use Flutter's SharedPreferences package to store key/value in app's storage. When I go to new-up a SharedPreferences through await SharedPreferences.getInstance()
, it builds and runs properly, but when the app reaches that line of code, it crashes with the following error:
MissingPluginException (MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences))
I have found other Stackoverflow posts, but they have not helped resolve this isue:
- MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences) while getting FCM in background
- Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/ for many packages on Flutter
- Flutter Test: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
- Flutter MissingPluginException(No implementation found for method getAll on channel ...) in release app
- Unhandled Exception: MissingPluginException(No implementation found for method flutterToWatch on channel it.example.watch)
- Flutter: Unhandled exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
- https://github.com/flutter/flutter/issues/98473
Through all of these, I have tried the following:
flutter pub get
io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin"));
- Since I am on iOS:
SharedPreferencesIOS.registerWith();
- https://pub.dev/packages/flutter_isolate
flutter clean && flutter pub get
SharedPreferences.setMockInitialValues({});
After running/doing the above steps, I restarted my editor (VSC). I even installed Android Studio with the Flutter extension and tried it out and it did not work. I tried running from the command line, but it still returns the same error. I tried restarting my computer and uninstalling and reinstalling flutter and dart for laughs. I really do not know what to do at this point. What steps am I missing?