Beacon.fromJson constructor
Beacon.fromJson(
- Map json
Creates a Beacon instance from a JSON map.
Implementation
factory Beacon.fromJson(Map json) {
return Beacon(
uuid: json['uuid'],
name: json['name'],
major: int.parse(json['major']),
minor: int.parse(json['minor']),
rssi: double.parse(json['rssi']),
deviceId: json['deviceId'] != null ? int.parse(json['deviceId']) : null,
mac: json['mac'],
txPower: json['txPower'] != null ? int.parse(json['txPower']) : null,
distance: json['distance'] != null
? double.parse(json['distance'])
: null,
battery: json['battery'] != null ? int.parse(json['battery']) : null,
isRange: json['isRange'] != null ? json['isRange'] == 'true' : null,
connectable: json['connectable'] != null
? json['connectable'] == 'true'
: null,
);
}