ESenseEvent.fromMap constructor

ESenseEvent.fromMap(
  1. Map map
)

Implementation

factory ESenseEvent.fromMap(Map<dynamic, dynamic> map) {
  final String type = map['type'] as String;
  switch (type) {
    case 'Listen':
      return RegisterListenerEvent(map['success'] as bool);
    case 'DeviceNameRead':
      return DeviceNameRead.fromMap(map);
    case 'BatteryRead':
      return BatteryRead.fromMap(map);
    case 'AccelerometerOffsetRead':
      return AccelerometerOffsetRead.fromMap(map);
    case 'AdvertisementAndConnectionIntervalRead':
      return AdvertisementAndConnectionIntervalRead.fromMap(map);
    case 'ButtonEventChanged':
      return ButtonEventChanged.fromMap(map);
    case 'SensorConfigRead':
      return SensorConfigRead.fromMap(map);
    default:
      return ESenseEvent();
  }
}