handlePlatformMessage abstract method
- @Deprecated('Instead of calling this method, use ServicesBinding.instance.channelBuffers.push. ' 'In tests, consider using tester.binding.defaultBinaryMessenger.handlePlatformMessage ' 'or TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage. ' 'This feature was deprecated after v3.9.0-19.0.pre.')
- String channel,
- ByteData? data,
- PlatformMessageResponseCallback? callback
Queues a message.
The returned future completes immediately.
This method adds the provided message to the given channel (named by the
channel
argument) of the ChannelBuffers object. This simulates what
happens when a plugin on the platform thread (e.g. Kotlin or Swift code)
sends a message to the plugin package on the Dart thread.
The data
argument contains the message as encoded bytes. (The format
used for the message depends on the channel.)
The callback
argument, if non-null, is eventually invoked with the
response that would have been sent to the platform thread.
In production code, it is more efficient to call
ServicesBinding.instance.channelBuffers.push
directly.
In tests, consider using
tester.binding.defaultBinaryMessenger.handlePlatformMessage
(see
WidgetTester, TestWidgetsFlutterBinding, TestDefaultBinaryMessenger,
and TestDefaultBinaryMessenger.handlePlatformMessage respectively).
To register a handler for a given message channel, see setMessageHandler.
To send a message to a plugin on the platform thread, see send.
Implementation
@Deprecated(
'Instead of calling this method, use ServicesBinding.instance.channelBuffers.push. '
'In tests, consider using tester.binding.defaultBinaryMessenger.handlePlatformMessage '
'or TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage. '
'This feature was deprecated after v3.9.0-19.0.pre.'
)
Future<void> handlePlatformMessage(String channel, ByteData? data, ui.PlatformMessageResponseCallback? callback);