BleCharacteristic.fromMap constructor

BleCharacteristic.fromMap(
  1. Map map
)

Implementation

factory BleCharacteristic.fromMap(Map<dynamic, dynamic> map) {
  final Map<dynamic, dynamic> properties =
      map[BleChannelKey.properties] is Map
      ? map[BleChannelKey.properties] as Map
      : const <dynamic, dynamic>{};

  return BleCharacteristic(
    remoteId: BleRemoteId(map[BleChannelKey.remoteId] as String? ?? ''),
    primaryServiceUuid: map[BleChannelKey.primaryServiceUuid] as String?,
    serviceUuid: map[BleChannelKey.serviceUuid] as String? ?? '',
    characteristicUuid:
        map[BleChannelKey.characteristicUuid] as String? ?? '',
    instanceId: map[BleChannelKey.instanceId] as int? ?? 0,
    discoveredProperties: BleCharacteristicProperties.fromMap(properties),
  );
}