BluetoothDevice.fromMap constructor

BluetoothDevice.fromMap(
  1. Map map
)

Creates BluetoothDevice from map.

Internally used to receive the object from platform code.

Implementation

factory BluetoothDevice.fromMap(Map map) {
  return BluetoothDevice(
    name: map["name"],
    address: map["address"]!,
    type: map["type"] != null
        ? BluetoothDeviceType.fromUnderlyingValue(map["type"])
        : BluetoothDeviceType.unknown,
    isConnected: map["isConnected"] ?? false,
    bondState: map["bondState"] != null
        ? BluetoothBondState.fromUnderlyingValue(map["bondState"])
        : BluetoothBondState.unknown,
  );
}