import 'dart:async'; import 'package:vibrate/vibrate.dart'; bool canVibrate = false; void vibrate(FeedbackType feedbackType) async{ canVibrate = await Vibrate.canVibrate; print('_vibrate'); if (canVibrate) { print('vibrate -- type: $feedbackType'); Vibrate.feedback(feedbackType); } } void vibrateDelayed(FeedbackType feedbackType, Duration duration) async{ canVibrate = await Vibrate.canVibrate; Future.delayed(duration,() { print('_vibrate'); if (canVibrate) { print('vibrate -- type: $feedbackType'); Vibrate.feedback(feedbackType); } }); }