TextEditingValue.fromJSON constructor

TextEditingValue.fromJSON(Map<String, dynamic> encoded)

Creates an instance of this class from a JSON object.

Implementation

factory TextEditingValue.fromJSON(Map<String, dynamic> encoded) {
  return TextEditingValue(
    text: encoded['text'],
    selection: TextSelection(
      baseOffset: encoded['selectionBase'] ?? -1,
      extentOffset: encoded['selectionExtent'] ?? -1,
      affinity: _toTextAffinity(encoded['selectionAffinity']) ?? TextAffinity.downstream,
      isDirectional: encoded['selectionIsDirectional'] ?? false,
    ),
    composing: TextRange(
      start: encoded['composingBase'] ?? -1,
      end: encoded['composingExtent'] ?? -1,
    ),
  );
}