Skip to content

Commit 3c1a152

Browse files
committed
fix: rangerError when selection is Invalid.
Signed-off-by: xsahil03x <[email protected]>
1 parent 0f718e3 commit 3c1a152

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
## Upcoming
22

3-
* Fix `FieldView` focus getting lost on clicking the `OptionsView` on non-mobile platforms.
3+
* Fixed `FieldView` focus getting lost on clicking the `OptionsView` on non-mobile platforms.
4+
* Fixed `RangeError` when `textEditingValue.selection.isInvalid`. [#11](https://github.com/xsahil03x/multi_trigger_autocomplete/issues/11)
45

56
## 0.1.1
67

7-
* Fix Readme.
8+
* Fixed Readme.
89

910
## 0.1.0
1011

Diff for: lib/src/autocomplete_trigger.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ class AutocompleteTrigger {
6262
/// the autocomplete query if so.
6363
AutocompleteQuery? invokingTrigger(TextEditingValue textEditingValue) {
6464
final text = textEditingValue.text;
65-
final cursorPosition = textEditingValue.selection.baseOffset;
65+
final selection = textEditingValue.selection;
66+
67+
// If the selection is invalid, then it's not a trigger.
68+
if (!selection.isValid) return null;
69+
final cursorPosition = selection.baseOffset;
6670

6771
// Find the first [trigger] location before the input cursor.
6872
final firstTriggerIndexBeforeCursor =

0 commit comments

Comments
 (0)