How To Make A Compact Notification With FCM (Firebase Cloud Messaging)?

Since FCM does not let me send a URL type "icon", I was trying to apply local notifications as soon as messages arrived by FCM of type "data". But messages of type "data" are not handled when the application is closed, so I had to reuse those of type "notification". Since the "icon" option does not work with URLs I was thinking of using "image", but I only need the small one that acts as an icon. Is there any way to compact the message so that it hides the large image and only shows the small one?

It would be something like the second message in the image below, this hidden big image to receive another message.

example image

The JSON structure of the notification in REST is as follows:

    "to": "fVJq6D9...................................",
    "notification": {
        "title": "Title Message 2",
        "body": "Body Message 2",
        "image": ""

For the construction of the App I am using Flutter.



Currently this is not possible as the icon you want to set dynamically is the small icon set by setSmallIcon()which requires id to a locally stored resource as from it's definition:

     * Set the small icon to use in the notification layouts.  Different classes of devices
     * may return different sizes.  See the UX guidelines for more information on how to
     * design these icons.
     * @param icon A resource ID in the application's package of the drawable to use.
    public Builder setSmallIcon(int icon) {
        mNotification.icon = icon;
        return this;

You cannot get the id the an image fetched by server. Instead, you can try to create different notifications depending upon cases with corresponding small icons set in the code.