setNotificationField method
Add a field for notification.
Functions need to be deployed.
The content of the notification in title
and text
.
You can set the notification time with time
.
Execute save to apply the changes.
Implementation
FirestoreDynamicDocumentModel setNotificationField({
required String title,
required String text,
required DateTime time,
String timeKey = MetaConst.pushTime,
String titleKey = MetaConst.pushName,
String textKey = MetaConst.pushText,
}) {
assert(title.isNotEmpty, "The title is empty.");
assert(text.isNotEmpty, "The text is empty.");
assert(timeKey.isNotEmpty, "The time key is empty.");
assert(titleKey.isNotEmpty, "The title key is empty.");
assert(textKey.isNotEmpty, "The text key is empty.");
this[timeKey] = Timestamp.fromDate(time);
this[titleKey] = title;
this[textKey] = text;
return this;
}