felixmccuaig / flutter-autocomplete-textfield

An autocomplete Textfield for flutter
MIT License
181 stars 131 forks source link

The method 'call' was called on null. Using AutoCompleteTextField #41

Closed renatopastor1 closed 5 years ago

renatopastor1 commented 5 years ago

My view broke after a flutter update, it was working perfectly up until then.

flutter: ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════ flutter: The following NoSuchMethodError was thrown while dispatching notifications for FocusNode: flutter: The method 'call' was called on null. flutter: Receiver: null flutter: Tried calling: call(true) flutter: flutter: When the exception was thrown, this was the stack: flutter: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5) flutter: #1 new AutoCompleteTextFieldState. (package:autocomplete_textfield/autocomplete_textfield.dart:182:4) flutter: #2 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:206:21) flutter: #3 FocusNode._notify (package:flutter/src/widgets/focus_manager.dart:103:5) flutter: #4 FocusManager._update (package:flutter/src/widgets/focus_manager.dart:474:20) flutter: (elided 10 frames from package dart:async) flutter: flutter: The FocusNode sending notification was: flutter: FocusNode#c112f(FOCUSED)

renatopastor1 commented 5 years ago

Found a solution, the problem is with the focus node

You just need to add: onFocusChanged: (hasFocus) {}, to AutoCompleteTextField

it was the same issue as https://github.com/felixlucien/flutter-autocomplete-textfield/issues/39