onPlatformMessage property Null safety

  1. @Deprecated('Instead of calling this callback, use ServicesBinding.instance.channelBuffers.push. ' 'This feature was deprecated after v2.1.0-10.0.pre.')
  2. @override
PlatformMessageCallback? onPlatformMessage
override

Called whenever this platform dispatcher 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

@Deprecated(
  'Instead of calling this callback, use ServicesBinding.instance.channelBuffers.push. '
  'This feature was deprecated after v2.1.0-10.0.pre.'
)
@override
ui.PlatformMessageCallback? get onPlatformMessage => _platformDispatcher.onPlatformMessage;
  1. @Deprecated('Instead of setting this callback, use ServicesBinding.instance.defaultBinaryMessenger.setMessageHandler. ' 'This feature was deprecated after v2.1.0-10.0.pre.')
  2. @override
void onPlatformMessage=(PlatformMessageCallback? callback)
override

Implementation

@Deprecated(
  'Instead of setting this callback, use ServicesBinding.instance.defaultBinaryMessenger.setMessageHandler. '
  'This feature was deprecated after v2.1.0-10.0.pre.'
)
@override
set onPlatformMessage(ui.PlatformMessageCallback? callback) {
  _platformDispatcher.onPlatformMessage = callback;
}