W3cubDocs

/Dart 2

postEvent function

void postEvent (String eventKind, Map eventData)

Post an event of eventKind with payload of eventData to the Extension event stream.

Implementation

void postEvent(String eventKind, Map eventData) {
  if (eventKind is! String) {
    throw new ArgumentError.value(eventKind, 'eventKind', 'Must be a String');
  }
  if (eventData is! Map) {
    throw new ArgumentError.value(eventData, 'eventData', 'Must be a Map');
  }
  String eventDataAsString = json.encode(eventData);
  _postEvent(eventKind, eventDataAsString);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-developer/postEvent.html