I have the following file which is based on the firebase_messaging example on how to manage background messages (i.e. when the application is terminated or in the background).
The file currently contains the following:
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'notifications.dart';
Future<dynamic> backgroundMessageHandler(Map<String, dynamic> message) async {
print("backgroundHandler: $message");
SharedPreferences prefs = await SharedPreferences.getInstance();
print(prefs.getInt('latest_id'));
}
The application does receive the notification, which is revealed when it prints the contents of message but when I try and get the SharedPreferences the console presents me with the following messages and code execution stops:
I/flutter (17018): Unable to handle incoming background message.
I/flutter (17018): MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
Is it possible to fix this?