toJson method
Implementation
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['address'] = address;
if (connectionType == ConnectionType.BLE) {
data['platformName'] = name;
} else {
data['name'] = name;
}
data['connectionType'] =
connectionType == ConnectionType.BLE ? 'BLE' : 'USB';
data['isConnected'] = isConnected;
data['vendorId'] = vendorId;
data['productId'] = productId;
return data;
}