DeviceModel.fromJson constructor

DeviceModel.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory DeviceModel.fromJson(Map<String, dynamic> json) {
  return DeviceModel(
    id: json['id'],
    deviceId: json['deviceId'],
    type: DeviceType.fromValue(json['type']),
    notificationToken: json['notificationToken'],
    userId: json['userId'],
    companyId: json['companyId'],
    createdAt: DateTime.parse(json['createdAt']),
    updatedAt: json['updatedAt'] != null
        ? DateTime.parse(json['updatedAt'])
        : null,
  );
}