BleDevice.fromJson constructor

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

Implementation

factory BleDevice.fromJson(Map<String, dynamic> json) => BleDevice(
      address: json["bluetoothAddress"] ?? "",
      rssi: json["rssi"]?.toString() ?? "",
      timestamp: json["timestamp"]?.toString() ?? "",
      advType: json["advType"] ?? "",
      name: json["localName"] ?? "N/A",
      serviceUuids: json["serviceUuids"],
      manufacturerData: json["manufacturerData"] != null
          ? Uint8List.fromList(List<int>.from(json["manufacturerData"]))
          : Uint8List.fromList(List.empty()),
      adStructures: json["adStructures"] == null
          ? null
          : List<AdStructure>.from(json["adStructures"].map((x) =>
              AdStructure(type: x["type"], data: List<int>.from(x["data"])))),
    );