toJSON method

Map<String, dynamic> toJSON()

Returns a representation of this object as a JSON object.

Implementation

Map<String, dynamic> toJSON() {
  assert(_textRangeIsValid(selection, text));
  assert(_textRangeIsValid(composing, text));
  return <String, dynamic>{
    'text': text,
    'selectionBase': selection.baseOffset,
    'selectionExtent': selection.extentOffset,
    'selectionAffinity': selection.affinity.toString(),
    'selectionIsDirectional': selection.isDirectional,
    'composingBase': composing.start,
    'composingExtent': composing.end,
  };
}