TextEditingController.fromValue constructor Null safety
- TextEditingValue? value
Creates a controller for an editable text field from an initial TextEditingValue.
This constructor treats a null value
argument as if it were
TextEditingValue.empty.
Implementation
TextEditingController.fromValue(TextEditingValue? value)
: assert(
value == null || !value.composing.isValid || value.isComposingRangeValid,
'New TextEditingValue $value has an invalid non-empty composing range '
'${value.composing}. It is recommended to use a valid composing range, '
'even for readonly text fields',
),
super(value ?? TextEditingValue.empty);