haptic_feedback 0.5.1+1 haptic_feedback: ^0.5.1+1 copied to clipboard
A Flutter plugin for haptic feedback. While it utilizes standard iOS haptics, it aims to emulate these same haptic patterns on Android for a consistent experience across platforms.
haptic_feedback #
A haptic feedback plugin for both iOS and Android.
While it utilizes standard iOS haptics, it aims to emulate these same haptic patterns on Android for a consistent experience across platforms.
For more information on using the package in your Flutter app, you can read the article Using haptic feedback to make your Flutter app more interactive by Kamran. He provides detailed explanations on haptic feedback and when to use each type.
Getting Started #
1. Add the dependency #
flutter pub add haptic_feedback
2. Use the plugin #
final canVibrate = await Haptics.canVibrate();
await Haptics.vibrate(HapticsType.success);
await Haptics.vibrate(HapticsType.warning);
await Haptics.vibrate(HapticsType.error);
await Haptics.vibrate(HapticsType.light);
await Haptics.vibrate(HapticsType.medium);
await Haptics.vibrate(HapticsType.heavy);
await Haptics.vibrate(HapticsType.rigid);
await Haptics.vibrate(HapticsType.soft);
await Haptics.vibrate(HapticsType.selection);
Automatic Permissions Inclusion #
Android VIBRATE Permission #
When you integrate the haptic_feedback
plugin into your Flutter project, it will automatically include the necessary VIBRATE
permission in the final merged AndroidManifest.xml
of your app. This is due to the permission being declared in the plugin's manifest.
What this means for you:
-
No Manual Action Required: You don't have to add the
<uses-permission android:name="android.permission.VIBRATE"/>
permission to your app'sAndroidManifest.xml
manually. It will be automatically merged when building the app. -
Transparency: By using the
haptic_feedback
plugin, your app will request theVIBRATE
permission. Ensure that you are aware of all permissions your app requires, especially if you publish it on app stores. Some users may be sensitive to app permissions, even if they don't require explicit consent. -
Permission Overview: To review all permissions that your app requests due to plugins and your own declarations, inspect the final merged
AndroidManifest.xml
after a build. This will provide a comprehensive view of all permissions and other manifest entries.