lost my 2 days to fix this issue, it may helpful for you.
notification tag only for showing notification. you can access only data content on onResume/onLaunch.
If you want handle notification message inside onResume/onLaunch add those messages in data tag also, Then you can do what ever you want.
refer more detail on this link
send this notification message
{
"notification": {
"body": "body",
"title": "title"
},
"priority": "high",
"data": {
"body": "body",
"title": "title"
"click_action": "FLUTTER_NOTIFICATION_CLICK",
"id": "1",
"status": "done",
"image": "https://ibin.co/2t1lLdpfS06F.png",
},
"to": <your token>
}
you will receive below information onResume or onLaunch, your notification tag will be empty here
{notification: {}, data: {image: https://ibin.co/2t1lLdpfS06F.png, google.original_priority: high, google.sent_time: 1560858283888, google.delivered_priority: high, body: body , title: title, click_action: FLUTTER_NOTIFICATION_CLICK, google.message_id: 0:1560858283908500%eefdc741eefdc741, collapse_key: <package>, google.ttl: 2419200, from: <from>, id: 1, status: done}}
you can use title and body which is added in data tag.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…