text property

String get text

Implementation

String get text {
  var v = controller?.value;
  // 这里要考虑iOS原生中文输入法中存在候选词的情况,候选词不算做输入文本
  if (v != null) {
    if (v.isComposingRangeValid) {
      return '${v.composing.textBefore(v.text)}${v.composing.textAfter(v.text)}';
    } else {
      return v.text;
    }
  }
  return _cacheTextEditingValue?.text ?? '';
}
set text (String? text)

Implementation

set text(String? text) {
  value = value.copyWith(
    text: text,
    selection: const TextSelection.collapsed(offset: -1),
    composing: TextRange.empty,
  );
}