BleService.fromMap constructor

BleService.fromMap(
  1. Map<String, dynamic> map
)

Constructs a BleService from a map.

The map should contain a 'serviceUuid' key for the UUID of the service and a 'characteristics' key containing a list of maps, each of which can be used to initialize a BleCharacteristic instance.

Implementation

factory BleService.fromMap(Map<String, dynamic> map) {
  return BleService(
    serviceUuid: map['serviceUuid'] as String,
    characteristics: (map['characteristics'] as List)
        .map(
          (charMap) =>
              BleCharacteristic.fromMap(charMap as Map<String, dynamic>),
        )
        .toList(),
  );
}