TerminalReader.fromJson constructor

TerminalReader.fromJson(
  1. Object? json
)

Implementation

factory TerminalReader.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TerminalReader(
    action: map['action'] == null
        ? null
        : TerminalReaderAction.fromJson(map['action']),
    deviceSwVersion: map['device_sw_version'] == null
        ? null
        : (map['device_sw_version'] as String),
    deviceType: TerminalReaderDeviceType.fromJson(map['device_type']),
    id: (map['id'] as String),
    ipAddress:
        map['ip_address'] == null ? null : (map['ip_address'] as String),
    label: (map['label'] as String),
    livemode: (map['livemode'] as bool),
    location: map['location'] == null
        ? null
        : TerminalLocationOrId.fromJson(map['location']),
    metadata: (map['metadata'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    serialNumber: (map['serial_number'] as String),
    status: map['status'] == null
        ? null
        : TerminalReaderStatus.fromJson(map['status']),
  );
}