Device.fromJson constructor

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

Implementation

factory Device.fromJson(Map<String, dynamic> json) {
  return Device(
    awsLocation: json['AWSLocation'] != null
        ? AWSLocation.fromJson(json['AWSLocation'] as Map<String, dynamic>)
        : null,
    createdAt: timeStampFromJson(json['CreatedAt']),
    description: json['Description'] as String?,
    deviceArn: json['DeviceArn'] as String?,
    deviceId: json['DeviceId'] as String?,
    globalNetworkId: json['GlobalNetworkId'] as String?,
    location: json['Location'] != null
        ? Location.fromJson(json['Location'] as Map<String, dynamic>)
        : null,
    model: json['Model'] as String?,
    serialNumber: json['SerialNumber'] as String?,
    siteId: json['SiteId'] as String?,
    state: (json['State'] as String?)?.toDeviceState(),
    tags: (json['Tags'] as List?)
        ?.whereNotNull()
        .map((e) => Tag.fromJson(e as Map<String, dynamic>))
        .toList(),
    type: json['Type'] as String?,
    vendor: json['Vendor'] as String?,
  );
}