setNotificationField method

FirestoreDynamicDocumentModel setNotificationField({
  1. required String title,
  2. required String text,
  3. required DateTime time,
  4. String timeKey = MetaConst.pushTime,
  5. String titleKey = MetaConst.pushName,
  6. String textKey = MetaConst.pushText,
})

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;
}