How to get time from firebase_messaging push notifications?

Viewed 930

I am making a Flutter app on Android that receives notification from Firebase Cloud Messaging service. Is there any way for me to know the time that my phone received the notification? When my onMessage,onResume and onLaunch functions triggered I noticed that there was a "google.sent_time:" key but I do not know how to convert that into the actual time.

1 Answers

sent_time should be milliseconds since epoch. You can convert this timestamp to a date with the following snippet:

new DateTime.fromMillisecondsSinceEpoch(sentTime);
Related