toEvent method

Event toEvent()

Returns the actual Snowplow event instance based on the initialized field. Throws an exception if no valid event is found.

Implementation

Event toEvent() {
  if (webViewReader != null) {
    return webViewReader!;
  } else if (selfDescribing != null) {
    return selfDescribing!;
  } else if (structured != null) {
    return structured!;
  } else if (screenView != null) {
    return screenView!;
  } else if (pageViewEvent != null) {
    return pageViewEvent!;
  }
  throw Exception("No valid event found in MessageEvent");
}