title: Test Firebase Cloud Messaging with flutter
body: <p>I have Firebase Cloud Messaging set up for my app in Flutter. I have set up everything on the console. I also tested with postman which also works well. However, I also want to test within Flutter by which I know is possible too. </p>
  
  <p>But it doesn't work for me as I do not any notification nor error message. How can this be done?</p>
  
  <pre><code>Future&lt;Map&lt;String, dynamic&gt;&gt; sendAndRetrieveMessage() async {
      print("Wdwd");
      await firebaseMessaging.requestNotificationPermissions(
        const IosNotificationSettings(sound: true, badge: true, alert: true, provisional: false),
      );
      await http.post(
        'https://fcm.googleapis.com/fcm/send',
        headers: &lt;String, String&gt;{
          'Content-Type': 'application/json',
          'Authorization': 'key = $serverToken',
        },
        body: jsonEncode(
          &lt;String, dynamic&gt;{
            'notification': &lt;String, dynamic&gt;{
              'body': 'this is a body',
              'title': 'this is a title'
            },
            'priority': 'high',
            'data': &lt;String, dynamic&gt;{
              'click_action': 'FLUTTER_NOTIFICATION_CLICK',
              'id': '1',
              'status': 'done'
            },
            'to': "tokenString",
          },
        ),
      );
  
      final Completer&lt;Map&lt;String, dynamic&gt;&gt; completer =
      Completer&lt;Map&lt;String, dynamic&gt;&gt;();
      firebaseMessaging.configure(
        onMessage: (Map&lt;String, dynamic&gt; message) async {
          completer.complete(message);
        },
      );
      return completer.future;
    } 
  </code></pre>
  
  <p>I initiate this code with a button click. Didn't get any response. Please help me out.</p>