BleDiscoveredServicesEvent.fromMap constructor
BleDiscoveredServicesEvent.fromMap(
- Map map
Implementation
factory BleDiscoveredServicesEvent.fromMap(Map<dynamic, dynamic> map) {
final List<dynamic> services =
map[BleChannelKey.services] as List<dynamic>? ?? const <dynamic>[];
return BleDiscoveredServicesEvent(
remoteId: BleRemoteId(map[BleChannelKey.remoteId] as String? ?? ''),
services: services
.whereType<Map<String, dynamic>>()
.map(BleService.fromMap)
.toList(growable: false),
success:
map[BleChannelKey.success] == 1 || map[BleChannelKey.success] == true,
errorCode: map[BleChannelKey.errorCode] as int? ?? 0,
errorString: map[BleChannelKey.errorString] as String? ?? '',
);
}