Skip to content

Commit d23a5d8

Browse files
fix: dispose _typeAheadController only if it has been created inside FormBuilderTypeAheadState
#113
1 parent c615cdc commit d23a5d8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/src/fields/form_builder_typeahead.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ class FormBuilderTypeAheadState<T>
197197
@override
198198
void dispose() {
199199
// Dispose the _typeAheadController when initState created it
200+
if (widget.controller == null) {
201+
_typeAheadController.dispose();
202+
}
200203
super.dispose();
201-
_typeAheadController.dispose();
202204
}
203205

204206
@override

0 commit comments

Comments
 (0)