sendPortPlatformMessage method

void sendPortPlatformMessage(
  1. String name,
  2. ByteData? data,
  3. int identifier,
  4. SendPort port

Sends a message to a platform-specific plugin via a SendPort.

This operates similarly to sendPlatformMessage but is used when sending messages from background isolates. The port parameter allows Flutter to know which isolate to send the result to. The name parameter is the name of the channel communication will happen on. The data parameter is the payload of the message. The identifier parameter is a unique integer assigned to the message.


void sendPortPlatformMessage(
  String name,
  ByteData? data,
  int identifier,
  SendPort port) {
  final String? error =
      _sendPortPlatformMessage(name, identifier, port.nativePort, data);
  if (error != null) {
    throw Exception(error);