title: Generate Flutter Local Notification when background FCM Triggers
body: <p>Basically I am trying to make a notification when FCM <code>onBackgroundMessage</code> Triggers.
  While doing this I am getting a <code>NullPointerException</code> at the <code>.show(..)</code> method of FlutterLocalNotification Plugin. </p>
  
  <p>Here is my Code:</p>
  
  <pre><code> FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
      _firebaseMessaging.configure(
        onMessage: (Map&lt;String, dynamic&gt; message) async {
          print("onMessage: $message");
        },
        onBackgroundMessage: messageHandle,
        onLaunch: (Map&lt;String, dynamic&gt; message) async {
          print("onLaunch: $message");
        },
        onResume: (Map&lt;String, dynamic&gt; message) async {
          print("onResume: $message");
        },
      );
  Future&lt;dynamic&gt; messageHandle(Map&lt;String, dynamic&gt; message) async{
    if (message.containsKey("data")) {
      Map data = message['data'];
      String topic;
      if (data.containsKey("topic")) topic = data['topic'];
      if (topic == "VendorNewTrips") {
        String amount = data['amount'];
        String vehicle = data['vehicle'];
        String tripType = data['tripType'];
        String pickUpDate= data['pickUpDate'];
        String pickUpTime = data['pickUpTime'];
        String locations= data['locations'];
        FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
        new FlutterLocalNotificationsPlugin();
  
        new AndroidInitializationSettings('app_icon');
        var bigTextStyleInformation = BigTextStyleInformation(
            'Locations: &lt;b&gt;${locations.replaceAll("\$", " to ")}&lt;/b&gt;&lt;br&gt;Vehicle: &lt;b&gt;$vehicle&lt;/b&gt;&lt;br&gt;Trip Type: &lt;b&gt;$tripType&lt;/b&gt;&lt;br&gt;Pick-Up Date: &lt;b&gt;$pickUpDate&lt;/b&gt;&lt;br&gt;Pick-Up Time: &lt;b&gt;$pickUpTime&lt;/b&gt;',
            htmlFormatBigText: true,
            contentTitle: 'Amount:- &lt;b&gt;Rs $amount&lt;/b&gt;',
            htmlFormatContentTitle: true,
            summaryText: 'Trip Details',
            htmlFormatSummaryText: true);
        var androidPlatformChannelSpecifics = AndroidNotificationDetails(
            '1687497218170948721x8',
            'New Trips Notification ',
            'Notification Channel for vendor. All the new trips notifications will arrive here.',
            style: AndroidNotificationStyle.BigText,
            styleInformation: bigTextStyleInformation);
        var platformChannelSpecifics =
        NotificationDetails(androidPlatformChannelSpecifics, null);
  
        flutterLocalNotificationsPlugin.show(5, 'Let\'s Get Wride!',
            'You Have Got A New Trip!', platformChannelSpecifics,);
      }
    }
    return null;
  }
  
  </code></pre>
  
  <pre><code>E/MethodChannel#dexterous.com/flutter/local_notifications(15092): Failed to handle method call
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:208)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:180)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:693)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:785)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:714)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at android.os.MessageQueue.nativePollOnce(Native Method)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at android.os.MessageQueue.next(MessageQueue.java:326)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at android.os.Looper.loop(Looper.java:190)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at android.app.ActivityThread.main(ActivityThread.java:7211)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at java.lang.reflect.Method.invoke(Native Method)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:575)
  E/MethodChannel#dexterous.com/flutter/local_notifications(15092):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:903)
  E/flutter (15092): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null)
  E/flutter (15092): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
  E/flutter (15092): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
  E/flutter (15092): &lt;asynchronous suspension&gt;
  E/flutter (15092): #2      AndroidFlutterLocalNotificationsPlugin.show (package:flutter_local_notifications/src/platform_flutter_local_notifications.dart:135:21)
  E/flutter (15092): #3      FlutterLocalNotificationsPlugin.show (package:flutter_local_notifications/src/flutter_local_notifications_plugin.dart:93:13)
  E/flutter (15092): #4      messageHandle (package:wride/SplashScreen/SplashScreen.dart:155:39)
  E/flutter (15092): #5      _fcmSetupBackgroundChannel.&lt;anonymous closure&gt; (package:firebase_messaging/firebase_messaging.dart:38:30)
  E/flutter (15092): #6      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:402:55)
  E/flutter (15092): #7      MethodChannel.setMethodCallHandler.&lt;anonymous closure&gt; (package:flutter/src/services/platform_channel.dart:370:54)
  E/flutter (15092): #8      _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:200:33)
  E/flutter (15092): #9      _invoke3.&lt;anonymous closure&gt; (dart:ui/hooks.dart:303:15)
  E/flutter (15092): #10     _rootRun (dart:async/zone.dart:1126:13)
  E/flutter (15092): #11     _CustomZone.run (dart:async/zone.dart:1023:19)
  E/flutter (15092): #12     _CustomZone.runGuarded (dart:async/zone.dart:925:7)
  E/flutter (15092): #13     _invoke3 (dart:ui/hooks.dart:302:10)
  E/flutter (15092): #14     _dispatchPlatformMessage (dart:ui/hooks.dart:162:5)
  E/flutter (15092): 
  </code></pre>
  
  <p>I want to make my own stylish notification when background message triggers because FCM doesnot support Notification Styles.
  Please Help!</p>
  
  <p>Edit: I looked into the plugin FlutterLocalNotification and came to know that the <a href="https://github.com/MaikuB/flutter_local_notifications/blob/master/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/models/NotificationDetails.java" rel="nofollow noreferrer">NotificationDetails.java Line 151</a> <code>Interger iconResourceID</code> is null all the time. I don't know what to do now.</p>