playFailureFeedback static method

Future<void> playFailureFeedback({
  1. bool sound = true,
  2. bool vibration = true,
})

Emits failure/error feedback (heavy haptic vibration).

Implementation

static Future<void> playFailureFeedback({
  bool sound = true,
  bool vibration = true,
}) async {
  if (vibration) {
    try {
      await HapticFeedback.heavyImpact();
    } catch (_) {}
  }
  if (sound) {
    try {
      await SystemSound.play(SystemSoundType.alert);
    } catch (_) {}
  }
}