send method

  1. @override
Future<ByteData?>? send(
  1. String channel,
  2. ByteData? message
)
override

Send a binary message to the platform plugins on the given channel.

Returns a Future which completes to the received response, undecoded, in binary form.

Implementation

@override
Future<ByteData?>? send(
  String channel,
  ByteData? message,
) {
  if (channel == SystemChannels.textInput.name) {
    final methodCall = SystemChannels.textInput.codec.decodeMethodCall(
      message,
    );
    switch (methodCall.method) {
      case 'TextInput.show':
        final FocusNode? focus = FocusManager.instance.primaryFocus;
        if (focus != null &&
            focus is TextInputFocusNode &&
            focus.ignoreSystemKeyboardShow) {
          return Future.value(
            SystemChannels.textInput.codec.encodeSuccessEnvelope(null),
          );
        }
        break;
      default:
        break;
    }
  }
  return origin.send(channel, message);
}