FlutterToast icon indicating copy to clipboard operation
FlutterToast copied to clipboard

Showing a second toast before the previous one disappears makes it disappear too soon

Open atn832 opened this issue 3 years ago • 1 comments

If I show a first toast for 5 seconds, then after 4 seconds show a second toast, then the second message gets shown only one second. Seems like there are two ways one could fix that:

  • Using a Timer instead of Future.delayed. Timers can be canceled. https://api.dart.dev/stable/2.3.1/dart-async/Timer/cancel.html
  • Wrapping the Future.delayed with a CancelableOperation. https://pub.dev/documentation/async/latest/async/CancelableOperation-class.html

atn832 avatar Oct 24 '22 08:10 atn832

https://github.com/appdev/FlutterToast/blob/372fe042d59df14d0a9df4d752b7d5e9b5ebae43/lib/toast.dart#L121-L122

atn832 avatar Oct 24 '22 08:10 atn832