FlutterToast
FlutterToast copied to clipboard
Showing a second toast before the previous one disappears makes it disappear too soon
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
Timerinstead ofFuture.delayed. Timers can be canceled. https://api.dart.dev/stable/2.3.1/dart-async/Timer/cancel.html - Wrapping the
Future.delayedwith aCancelableOperation. https://pub.dev/documentation/async/latest/async/CancelableOperation-class.html
https://github.com/appdev/FlutterToast/blob/372fe042d59df14d0a9df4d752b7d5e9b5ebae43/lib/toast.dart#L121-L122