receiveAction method Null safety

Future<void> receiveAction(
  1. TextInputAction action

Simulates the user pressing one of the TextInputAction buttons. Does not check that the TextInputAction performed is an acceptable one based on the inputAction setClientArgs.

This can be called even if the TestTextInput has not been registered.

If this is used to inject an action when there is a real IME connection, for example when using the integration_test library, there is a risk that the real IME will become confused as to the current state of input.


Future<void> receiveAction(TextInputAction action) async {
  return TestAsyncUtils.guard(() {
    final Completer<void> completer = Completer<void>();
          <dynamic>[_client ?? -1, action.toString()],
      (ByteData? data) {
        assert(data != null);
        try {
          // Decoding throws a PlatformException if the data represents an
          // error, and that's all we care about here.
          // If we reach here then no error was found. Complete without issue.
        } catch (error) {
          // An exception occurred as a result of receiveAction()'ing. Report
          // that error.
    return completer.future;