更新
This commit is contained in:
@@ -8,6 +8,8 @@ class BlueToothDataModel {
|
||||
String macA;
|
||||
String macB;
|
||||
int type;
|
||||
String? macAID;
|
||||
String? macBID;
|
||||
|
||||
BlueToothDataModel({
|
||||
this.name = '',
|
||||
@@ -19,18 +21,13 @@ class BlueToothDataModel {
|
||||
this.macB = '',
|
||||
});
|
||||
|
||||
factory BlueToothDataModel.fromScanResult(ScanResult result,int type,
|
||||
factory BlueToothDataModel.fromScanResult(ScanResult result, int type,
|
||||
{bool bind = false, String name = '', String mac = ''}) {
|
||||
// 如果外部没有传入 name,则取 localName
|
||||
String finalName =
|
||||
name.isNotEmpty ? name : (result.advertisementData.localName ?? '');
|
||||
|
||||
return BlueToothDataModel(
|
||||
name: finalName,
|
||||
bind: bind,
|
||||
mac: mac,
|
||||
scanResult: result,
|
||||
type:type
|
||||
);
|
||||
name: finalName, bind: bind, mac: mac, scanResult: result, type: type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user