text selection affinity can be null on web (#62778)

This commit is contained in:
Alexandre Ardhuin 2020-08-03 23:26:05 +02:00 committed by GitHub
parent 2b51ac6f35
commit e3c3d6eb7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -594,7 +594,7 @@ class TextInputConfiguration {
}
}
TextAffinity? _toTextAffinity(String affinity) {
TextAffinity? _toTextAffinity(String? affinity) {
switch (affinity) {
case 'TextAffinity.downstream':
return TextAffinity.downstream;
@ -662,7 +662,7 @@ class TextEditingValue {
selection: TextSelection(
baseOffset: encoded['selectionBase'] as int? ?? -1,
extentOffset: encoded['selectionExtent'] as int? ?? -1,
affinity: _toTextAffinity(encoded['selectionAffinity'] as String) ?? TextAffinity.downstream,
affinity: _toTextAffinity(encoded['selectionAffinity'] as String?) ?? TextAffinity.downstream,
isDirectional: encoded['selectionIsDirectional'] as bool? ?? false,
),
composing: TextRange(