onPlatformMessage property

PlatformMessageCallback onPlatformMessage

Called whenever this window receives a message from a platform-specific plugin.

The name parameter determines which plugin sent the message. The data parameter is the payload and is typically UTF-8 encoded JSON but can be arbitrary data.

Message handlers must call the function given in the callback parameter. If the handler does not need to respond, the handler should pass null to the callback.

The framework invokes this callback in the same zone in which the callback was set.

Implementation

PlatformMessageCallback get onPlatformMessage => _onPlatformMessage;
void onPlatformMessage= (PlatformMessageCallback callback)

Implementation

set onPlatformMessage(PlatformMessageCallback callback) {
  _onPlatformMessage = callback;
  _onPlatformMessageZone = Zone.current;
}