17 lines
491 B
Dart
17 lines
491 B
Dart
import 'dart:async' show unawaited;
|
|
|
|
import 'package:haptic_kit/haptic_kit.dart';
|
|
|
|
/// Prepare mobile haptics without surfacing platform failures.
|
|
void prepareVoiceHaptics() {
|
|
unawaited(Haptics.prepare().catchError((_) => false));
|
|
}
|
|
|
|
/// Play the standard touch PTT haptic without surfacing platform failures.
|
|
void playVoicePttHaptic(bool held) {
|
|
final haptic = held
|
|
? Haptics.impact(HapticImpactStyle.medium)
|
|
: Haptics.selection();
|
|
unawaited(haptic.catchError((_) {}));
|
|
}
|