scribbleRequestElementsInRect method

Future<List<List>> scribbleRequestElementsInRect(
  1. Rect rect
)

Simulates iOS asking for the list of Scribble elements during UIIndirectScribbleInteraction.

Implementation

Future<List<List<dynamic>>> scribbleRequestElementsInRect(Rect rect) async {
  assert(isRegistered);
  List<List<dynamic>> response = <List<dynamic>>[];
  await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
    SystemChannels.textInput.name,
    SystemChannels.textInput.codec.encodeMethodCall(
      MethodCall(
        'TextInputClient.requestElementsInRect',
         <dynamic>[rect.left, rect.top, rect.width, rect.height]
      ),
    ),
    (ByteData? data) {
      response = (SystemChannels.textInput.codec.decodeEnvelope(data!) as List<dynamic>).map((dynamic element) => element as List<dynamic>).toList();
    },
  );

  return response;
}