How to convert Firebase data to DateTime for schedule notifications? - flutter

I want to convert the date information from Firebase Firestore, to DateTime, which I will use as a base for scheduled notifications.
Here is the scheduled notification function
enter image description here
I looked for many answers but still couldn't find a solution.
I tried this but it doesn't work.enter image description here

Related

How to minimize Firestore data? Mutiple fields with boolean type or one Map field type?

I'm making a social media app using flutter and firebase.
I'm making push notifications to alert users on certain actions like somebody is following or send a comment or press like button. Also, there will be a push notification settings page.
I want to let users to choose to turn on and off push notifications on certain actions. For example, a user only wants to get push notification when someone is following on him. Then, the user can just turn off all the other push notifications except following push notification.
What I did was make every fields of every push notifications on certain actions.
For example, I made 4 data fields in user's firebase document for each certain push notifications.
I have a different idea which is making one field of Map type data that contains multiple push notifications like this.
Which way would be the better idea to minimize the size of Firestore data and reduce the cost?
Thank you so much for reading this and if you have other ideas, please let me know :)
Better have different fields - anyway you will receive one dataset, and you don't need to make another "dataset" in this (in same situation you will receive more long response because of additional string markup for inner json)
Also, if you have different fields you can more efficient query it if you need, with less data exchange between client and server

Appending to a list of messagingStyle notification using flutter_local_notifications

I have a messaging style notification where I need to append messages to a list of messages but I have no context about the messages which have already been shown using .show().
I can get information about the active notifications using getActiveNotifications() but there is no information about the icons or other assets which were also used in those notifications. The ActiveNotification class does not provide any such information about the notification.
I'm able to append content to simple notifications that don't contain any media but have not been able to do so for notification styles like the BigPictureStyle or the MessagingStyle notification since I'm not able to access the media used in previous notifications.
Is it possible to somehow get information about these additional details as well? Or better yet, is there a better way to achieve the above in Flutter using flutter_local_notifications.

Flutter - If get this keyword in the title from a push notification do this action

I'd like to be able to do actions when receiving specific keywords in the title of notifications coming from specific apps. I've read about the notifications package and notificationlistener. The first one says that it can just give me the app name and timestamp, but I don't understand if it would fit my needs, and the second one (notificationlistener) I'm not sure it could solve my issue.
How can I do what I want? Let's say I receive a notification containing in the title "Breaking News" and I want to copy paste the title and the notification content in my app automatically every time I receive that, how do I do that?
I'm very new to Flutter, so, please explain easily what I should do and if it's feasible in Flutter without recurring to native code.

I want to make Birthday reminder notification using flutter

I am making an application using flutter so every teacher has some students in their class so they see their students only in the first screen , I want to send to the teacher notification before each student birthday by 2 days , also i want to send a notification at the beginning of each month (day 1) with all of the birthdays of the students at this month ..
ex: Mark birthday is on 5/9 , Thomas is on 19/9 so i want to send the teacher a notification at day 1 of the month that there is 2 birthdays on this month for Mark and Thomas .
I've searched alot really and i can't do anything .
You have to implement Firebase Messaging or One Signal and need to send notification from the server. You can generate FCM token and then send it to specific devices. Using Pubsub in Firebase Functions you can check daily notification and check if any birthday is coming after 2 days of the following day. If there is Birthday then it will send the notification to the user using the FCM token registered. Here are some resources:
Flutter Firebase Notification using Firebase Functions
Schedule Function using Pubsub and Firebase Functions

How to get time from firebase_messaging push notifications?

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.
sent_time should be milliseconds since epoch. You can convert this timestamp to a date with the following snippet:
new DateTime.fromMillisecondsSinceEpoch(sentTime);