fromMap static method

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

Converts a map to an AhapEvent

Implementation

// {
//  "Event": {
//    "Time": 0.043859649122807015,
//    "EventType": "HapticContinuous",
//    "EventDuration": 0.8771929824561403,
//    "EventParameters": [
//      {
//        "ParameterID": "HapticIntensity",
//        "ParameterValue": 0.9764705882352941
//      },
//      {
//        "ParameterID": "HapticSharpness",
//        "ParameterValue": 0.9764705882352941
//      }
//    ]
//  }
//}
static List<AhapEvent> fromMap(Map<String, dynamic> map) {
  if (map.containsKey(AhapConstants.keys.event)) {
    return _mapBasicEvents(map);
  }

  if (map.containsKey(AhapConstants.keys.parameter)) {
    return _mapParameterEvents(map);
  }

  if (map.containsKey(AhapConstants.keys.parameterCurve)) {
    return _mapParameterCurves(map);
  }

  throw Exception('No support yet for this type of event: ${map.keys.first}');
}