ESenseEvent.fromMap constructor

ESenseEvent.fromMap(Map map)

Implementation

factory ESenseEvent.fromMap(Map<dynamic, dynamic> map) {
  String type = map['type'];
  switch (type) {
    case 'Listen':
      return RegisterEventListener(map['success']);
    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(type);
  }
}