ScanRecord.fromJson constructor

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

Implementation

factory ScanRecord.fromJson(Map<String, dynamic> json) {
  return ScanRecord(
    name: json.containsKey('name') ? json['name'] as String : null,
    uuids: json.containsKey('uuids')
        ? (json['uuids'] as List).map((e) => e as String).toList()
        : null,
    appearance:
        json.containsKey('appearance') ? json['appearance'] as int : null,
    txPower: json.containsKey('txPower') ? json['txPower'] as int : null,
    manufacturerData: json.containsKey('manufacturerData')
        ? (json['manufacturerData'] as List)
            .map((e) => ManufacturerData.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
  );
}