vibration_service 0.1.2
vibration_service: ^0.1.2 copied to clipboard
Lightweight haptic helpers for Flutter using HapticFeedback—success, failure, refresh, warning, selection, and custom duration patterns.
vibration_service #
Small, static helpers for consistent haptic feedback in Flutter apps using
HapticFeedback.
Install #
dependencies:
vibration_service: ^0.1.0
Run flutter pub get.
Usage #
Import the library and call the methods from your widgets or logic (for example after a network error or a successful save):
import 'package:vibration_service/vibration_service.dart';
// On validation / API error
await VibrationService.failure();
await VibrationService.success();
await VibrationService.onRefresh();
await VibrationService.warning();
await VibrationService.selection();
await VibrationService.scroll();
await VibrationService.light();
await VibrationService.heavy();
// Alternating vibrate (even indices, ms) and pause (odd indices, ms)
await VibrationService.custom([30, 50, 80, 50]);
Notes #
- Uses haptics (short taps), not the device vibrator motor API; behavior depends on the platform and hardware.
_canVibratecurrently always returnstrue; you can fork or extend the package to query settings or platform capabilities if you need that.
Important #
-
Android: add
-
iOS: Mention that vibration only works on physical devices, not simulators.