binaryMessenger property

BinaryMessenger binaryMessenger

The messenger which sends the bytes for this channel.

On the root isolate or web, this defaults to the ServicesBinding.defaultBinaryMessenger. In other contexts the default value is a BackgroundIsolateBinaryMessenger from BackgroundIsolateBinaryMessenger.ensureInitialized.

Implementation

BinaryMessenger get binaryMessenger {
  final BinaryMessenger result = _binaryMessenger ?? _findBinaryMessenger();
  return shouldProfilePlatformChannels
      ? _profiledBinaryMessengers[this] ??= _ProfiledBinaryMessenger(
          // ignore: no_runtimetype_tostring
          result, runtimeType.toString(), codec.runtimeType.toString())
      : result;
}