playSuccessFeedback static method

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

Emits success feedback (light/medium haptic vibration & system sound).

Implementation

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