Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cancel() works only on the 1st time #512

Open
subzero911 opened this issue Jun 19, 2024 · 0 comments
Open

cancel() works only on the 1st time #512

subzero911 opened this issue Jun 19, 2024 · 0 comments

Comments

@subzero911
Copy link

subzero911 commented Jun 19, 2024

I want to cancel the toast everytime I press the key.

But it works only on the 1st time, next toasts are not cancelled:

bad.toast.video_2024-06-19_15-02-19.mp4

code:

@override
  void initState() {
    super.initState();
    nameTextController = TextEditingController()
      ..addListener(() async {
        if (nameTextController.text.length > 40) {
          await Fluttertoast.cancel();
          Fluttertoast.showToast(msg: 'Max 40 characters').ignore();
        }
      });
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant