From e3c3d6eb7e7bad796195522f7a9ce557fd40a060 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Mon, 3 Aug 2020 23:26:05 +0200 Subject: [PATCH] text selection affinity can be null on web (#62778) --- packages/flutter/lib/src/services/text_input.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index d98009d090..079c211975 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -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(