Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Using a controller with easy_autocomplete does not work correctly #5

Closed
jamolina2021 opened this issue Dec 14, 2021 · 2 comments · Fixed by #6
Closed

Using a controller with easy_autocomplete does not work correctly #5

jamolina2021 opened this issue Dec 14, 2021 · 2 comments · Fixed by #6
Labels
bug Something isn't working

Comments

@jamolina2021
Copy link

Hello @4inka,

I am using a TextEditingController control with your plugin, but when doing the dispose it produces the following error:
"A TextEditingController was used after being disposed.
Once you have called dispose() on a TextEditingController, it can no longer be used."
The code I am using is the following:

class _LoginPageState extends State<LoginPage> {
  TextEditingController _easyAutocompleteController = TextEditingController();

  @override
  void initState() {
    super.initState();
    _easyAutocompleteController.text = _prefs.lastUserSel;
    _userName = _easyAutocompleteController.text;
  }

  @override
  void dispose() {
    _easyAutocompleteController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      .....
      .....
                                  EasyAutocomplete(
                                controller: _easyAutocompleteController,
                                decoration: InputDecoration(
                                  fillColor: Colors.red,
                                  border: InputBorder.none,
                                  .....
                                  .....

Is it a problem with my code or is it an easy_autocomplete bug?
Thank you very much for your help.

@4inka 4inka closed this as completed in #6 Dec 14, 2021
@4inka 4inka added the bug Something isn't working label Dec 14, 2021
@4inka
Copy link
Owner

4inka commented Dec 14, 2021

Hello @jamolina2021

Thank you for the feedback. I was able to reproduce your issue and can confirm that was a bug related to the package.
Just published the version with the fix to pub.dev and you can try it again by updating the package version to 1.2.2.

@jamolina2021
Copy link
Author

Many thanks. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants