UserNotificationVO.fromModel constructor

UserNotificationVO.fromModel(
  1. UserNotificationModel model
)

Implementation

factory UserNotificationVO.fromModel(UserNotificationModel model) {
  return UserNotificationVO(
    uid: model.uid!,
    snapshot: model.snapshot,
    message: model.message,
    userId: model.userId,
    from: model.from,
    channelData: model.channelData,
    state: model.state,
    channelTypes: model.channelTypes,
    createdAt: DateTime.fromMillisecondsSinceEpoch(model.createdAt.toInt()),
    updatedAt: model.updatedAt is double
        ? DateTime.fromMillisecondsSinceEpoch(model.updatedAt!.toInt())
        : null,
    deliveredAt: model.deliveredAt is double
        ? DateTime.fromMillisecondsSinceEpoch(model.deliveredAt!.toInt())
        : null,
    readAt: model.readAt is double
        ? DateTime.fromMillisecondsSinceEpoch(model.readAt!.toInt())
        : null,
    metadata: model.metadata,
  );
}