EventChannel constructor Null safety

const EventChannel(
  1. String name,
  2. [MethodCodec codec,
  3. BinaryMessenger? binaryMessenger]
)

Creates an EventChannel with the specified name.

The codec used will be StandardMethodCodec, unless otherwise specified.

Neither name nor codec may be null. The default ServicesBinding.defaultBinaryMessenger instance is used if binaryMessenger is null.

Implementation

const EventChannel(this.name, [this.codec = const StandardMethodCodec(), BinaryMessenger? binaryMessenger])
    : assert(name != null),
      assert(codec != null),
      _binaryMessenger = binaryMessenger;