postEvent function Null safety

void postEvent(
  1. String eventKind,
  2. Map eventData

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

If extensionStreamHasListener is false, this method is a no-op.


void postEvent(String eventKind, Map eventData) {
  if (!extensionStreamHasListener) {
  // TODO: When NNBD is complete, delete the following two lines.
  checkNotNullable(eventKind, 'eventKind');
  checkNotNullable(eventData, 'eventData');
  String eventDataAsString = json.encode(eventData);
  _postEvent(eventKind, eventDataAsString);