Device.fromJson constructor

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

Implementation

factory Device.fromJson(Map<String, dynamic> json) {
  return Device(
    id: json['id'] as String,
    name: json['name'] as String,
    os: DeviceOs.values.byName(json['type'] as String),
    platform: json['platform'] as String? ?? '',
    state: DeviceState.fromString(json['state'] as String? ?? 'Shutdown'),
    type: DeviceType.values.byName(json['type'] as String),
  );
}