binaryMessenger property Null safety

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 !kReleaseMode && debugProfilePlatformChannels
      ? _debugBinaryMessengers[this] ??= _ProfiledBinaryMessenger(
          // ignore: no_runtimetype_tostring
          result, runtimeType.toString(), codec.runtimeType.toString())
      : result;
}