FCM notification triggers app's code to update in local database in terminated state also

Like WhatsApp, i want to insert my incoming message in local database when notification arrives in all states like terminated state also without click on notification.

My FCM payload is

{
    "message": {
        "token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "apns": {
            "headers": {
                "apns-priority": "10"
            },
            "payload": {
                "aps": {
                    "alert": {
                        "title": "From Name",
                        "subtitle": "Group Name",
                        "body": "Message Text"
                    },
                    "sound" : "default",
                    "mutable-content" : 1
                }
            }
        }
    }
}

i am able to receive notification in terminated state also, but i want to invoke my app's code when notification receives like whatsapp.

i am using flutter, fcm.

FCM notification triggers app's code to update in local database in terminated state also
 
 
Q