Device.fromJson constructor

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

Implementation

factory Device.fromJson(Map<String, dynamic> json) {
  return Device(
    arn: json['arn'] as String?,
    availability: (json['availability'] as String?)?.toDeviceAvailability(),
    carrier: json['carrier'] as String?,
    cpu: json['cpu'] != null
        ? CPU.fromJson(json['cpu'] as Map<String, dynamic>)
        : null,
    fleetName: json['fleetName'] as String?,
    fleetType: json['fleetType'] as String?,
    formFactor: (json['formFactor'] as String?)?.toDeviceFormFactor(),
    heapSize: json['heapSize'] as int?,
    image: json['image'] as String?,
    instances: (json['instances'] as List?)
        ?.whereNotNull()
        .map((e) => DeviceInstance.fromJson(e as Map<String, dynamic>))
        .toList(),
    manufacturer: json['manufacturer'] as String?,
    memory: json['memory'] as int?,
    model: json['model'] as String?,
    modelId: json['modelId'] as String?,
    name: json['name'] as String?,
    os: json['os'] as String?,
    platform: (json['platform'] as String?)?.toDevicePlatform(),
    radio: json['radio'] as String?,
    remoteAccessEnabled: json['remoteAccessEnabled'] as bool?,
    remoteDebugEnabled: json['remoteDebugEnabled'] as bool?,
    resolution: json['resolution'] != null
        ? Resolution.fromJson(json['resolution'] as Map<String, dynamic>)
        : null,
  );
}