eventFromJson function

RawEvent eventFromJson(
  1. Map<String, dynamic> json
)

Implementation

RawEvent eventFromJson(Map<String, dynamic> json) {
  switch (json['type']) {
    case 'track':
      return TrackEvent.fromJson(json);
    case 'identify':
      return IdentifyEvent.fromJson(json);
    case 'group':
      return GroupEvent.fromJson(json);
    case 'alias':
      return AliasEvent.fromJson(json);
    case 'screen':
      return ScreenEvent.fromJson(json);
    default:
      throw JSONUnableToDeserialize('event', 'Invalid type: ${json['type']}');
  }
}