title: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences) while getting FCM in background
body: <p>I'm working on a Flutter app in which I'm using the shared_preferences: ^2.0.13 package.</p>
  <ul>
  <li><p>Flutter version : 2.10.1 (latest)</p>
  </li>
  <li><p>gradle version: 6.7</p>
  </li>
  <li><p>Android gradle plugin version: 4.1.3</p>
  </li>
  <li><p>kotlin version: 1.6.10</p>
  </li>
  <li><p>flutterEmbedding 2 (in android menifiest)</p>
  </li>
  </ul>
  <p>MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences).</p>
  <p>While getting FCM message received in background.</p>
  <p>main.dart</p>
  <pre><code>Future&lt;void&gt; _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
    await Firebase.initializeApp();
  
    print('Got a message onBackgroundMessageHandler_');
    print(&quot;Handling a background message: ${message.messageId}&quot;);
  
    print('Shared pref process starts');
    SharedPreferences sf = await SharedPreferences.getInstance();
    sf.setString(&quot;key&quot;, &quot;Value&quot;);
    print('${sf.getKeys()}');
    print('Shared pref process ends');
  }
  
  void main() async{
    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp();
  
    FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
  
    runApp(const MyApp());
  }
  </code></pre>
  <p>MainActivity.kt</p>
  <pre><code>class MainActivity: FlutterActivity() {
  
  }
  </code></pre>