Notification constructor
- @JsonKey(name: 'notificationid') required int id,
- @UnixTimestampConverter() required DateTime timestamp,
- @UnixTimestampConverter() @JsonKey(name: 'timestamp_read') DateTime? readAt,
- required NotificationType type,
- @JsonKey(name: 'info') int? context,
- @BoolConverter() @JsonKey(name: 'status') required bool read,
- @JsonKey(name: 'userid') required int userId,
A notification users receive.
Implementation
const factory Notification({
/// The notification's unique identifier.
@JsonKey(name: 'notificationid') required int id,
/// The timestamp when the notification was sent.
@UnixTimestampConverter() required DateTime timestamp,
/// The timestamp when the notification was read.
@UnixTimestampConverter() @JsonKey(name: 'timestamp_read') DateTime? readAt,
/// The type of the notification.
///
/// The message is displayed differently based on the type.
required NotificationType type,
/// Additional context for the notification.
/// Interpretation depends on the [type].
@JsonKey(name: 'info') int? context,
/// `true` if the notification has been read.
@BoolConverter() @JsonKey(name: 'status') required bool read,
@JsonKey(name: 'userid') required int userId,
}) = _Notification;