createBinaryMessenger method

  1. @override
TestDefaultBinaryMessenger createBinaryMessenger()

Creates a default BinaryMessenger instance that can be used for sending platform messages.

Many Flutter framework components that communicate with the platform assume messages are received by the platform in the same order in which they are sent. When overriding this method, be sure the BinaryMessenger implementation guarantees FIFO delivery.


TestDefaultBinaryMessenger createBinaryMessenger() {
  Future<ByteData?> keyboardHandler(ByteData? message) async {
    return const StandardMethodCodec().encodeSuccessEnvelope(<int, int>{});
  return TestDefaultBinaryMessenger(
    outboundHandlers: <String, MessageHandler>{'flutter/keyboard': keyboardHandler},