getText method

Future<String> getText()

Gets the text from the editor and returns it as a String.

Implementation

Future<String> getText() async {
  // if there is already a request for the text, complete it with an error
  if (_openRequests.keys.contains('getText')) {
    _openRequests['getText']?.completeError('Duplicate [getText] request');
    _openRequests.remove('getText');
  }
  _openRequests.addEntries({'getText': Completer<String>()}.entries);
  unawaited(evaluateJavascript(data: {'type': 'toIframe: getText'}));
  return _openRequests['getText']?.future as Future<String>;
}