Skip to content

Commit

Permalink
_RawAutocompleteState should dispose _highlightedOptionIndex. (#133700)
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c authored Aug 30, 2023
1 parent 31600c8 commit 95e197b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/flutter/lib/src/widgets/autocomplete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ class _RawAutocompleteState<T extends Object> extends State<RawAutocomplete<T>>
_floatingOptions?.remove();
_floatingOptions?.dispose();
_floatingOptions = null;
_highlightedOptionIndex.dispose();
super.dispose();
}

Expand Down
4 changes: 3 additions & 1 deletion packages/flutter/test/material/autocomplete_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';

class User {
const User({
Expand Down Expand Up @@ -45,7 +46,8 @@ void main() {
User(name: 'Charlie', email: '[email protected]'),
];

testWidgets('can filter and select a list of string options', (WidgetTester tester) async {
testWidgetsWithLeakTracking('can filter and select a list of string options', (WidgetTester tester) async {

late String lastSelection;
await tester.pumpWidget(
MaterialApp(
Expand Down

0 comments on commit 95e197b

Please sign in to comment.