-
Notifications
You must be signed in to change notification settings - Fork 242
Description
I’m getting the following error when trying to use the shared_preferences
package in a Flutter desktop app (with multiple windows / secondary engine):
PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.shared_preferences_foundation.LegacyUserDefaultsApi.getAll"., null, null)
It looks like the plugin cannot establish a connection to the method channel.
From what I understand, shared_preferences
relies on a platform channel that may not be registered when using multiple Flutter engines or secondary windows.
Questions
- What exactly does this error mean?
- Is
shared_preferences
limited to only the main Flutter engine? - How can I make it work in a secondary window / secondary
FlutterEngine
? - Is there a workaround (e.g., registering the plugin manually, or using another approach for storing preferences in additional windows)?
Environment
- Flutter:
Flutter 3.35.4
Framework • revision d693b4b9db (9 days ago) • 2025-09-16 14:27:41 +0000
Engine • hash feee8ee8fb8b975dd9990f86d3bda11e6e75faf3 (revision c298091351) (10 days ago) • 2025-09-15 14:04:24.000Z
Tools • Dart 3.9.2 • DevTools 2.48.0
- OS: [macOS/Linux/Windows]
- Package:
shared_preferences [version]