setText method

Future<void> setText(
  1. String text
)

Sets the text of the editor.

Implementation

Future<void> setText(String text) async {
  _buffer = text;
  if (!initialized) {
    // if the editor is not initialized yet, set the _buffer value
    // and return
    return;
  }
  if (kIsWeb) {
    await evaluateJavascript(
        data: {'type': 'toIframe: setText', 'text': text});
  } else {
    // on native platform - reload page with new value
    await reloadContent();
  }
  await recalculateContentHeight();
}