Skip to content

[shared_preferences] MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences) in isolate #98473

@urvesh-educloud

Description

@urvesh-educloud

I'm working on a Flutter app in which I'm using the shared_preferences: ^2.0.13 package.

Flutter version : 2.10.1 (latest)
gradle version: 6.7
Android gradle plugin version: 4.1.3
kotlin version: 1.6.10
flutterEmbedding 2 (in android menifiest)

MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences).

While getting FCM message received in background.
Kindly refer the below code

main.dart

Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();

  print('Got a message onBackgroundMessageHandler_');
  print("Handling a background message: ${message.messageId}");

  print('Shared pref process starts');
  SharedPreferences sf = await SharedPreferences.getInstance();
  sf.setString("key", "Value");
  print('${sf.getKeys()}');
  print('Shared pref process ends');
}
void main() async{
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();

  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);

  runApp(const MyApp());
}

MainActivity.kt

class MainActivity: FlutterActivity() {

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listfound in release: 2.10Found to occur in 2.10found in release: 2.11Found to occur in 2.11has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: shared_preferencesPlugin to read and write Shared Preferencespackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions