cancel() works only on the 1st time
subzero911 opened this issue · 2 comments
subzero911 commented
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();
}
});
}