Skip to content

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

@subzero911

Description

@subzero911

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();
        }
      });
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions