After some debugging(for my acctuale code), I was able to identify the root cause of the ANR (Application Not Responding) issue in my Flutter project when using Firebase notifications.
I had implemented Firebase Cloud Messaging (FCM) using the HTTP v1 API and was sending custom data along with the notification payload. This data was being stored locally using the sqflite plugin.
In the database, I had defined a table with some fields marked as NOT NULL. However, when sending notifications without including the expected data in the payload, the app still attempted to insert the incomplete data into the SQLite table. Since the NOT NULL constraints were violated, this led to exceptions during the insert operation — and for some reason, this caused the app to hang and eventually throw an ANR.
Once I ensured that the necessary data was always included in the notification payload — matching the table structure and respecting the NOT NULL fields — the issue was resolved.
Hope this helps others facing a similar issue!
But here I don't know why it's not working for the minimal code where i didn't used that function to store the data after fixing this for this minimal code then it's dosen't give the ANR.