There are a couple of different packages that you can use to implement vibrations in Flutter, but there's also actually a way to implement it without adding any new dependencies at all by using the HapticFeedback class. It's probably worth mentioning that this may not work with older devices because it utilizes Haptic Feedback...
First of all you'll need to add the vibrations permission below to your AndroidManifest.xml file(for Android support):
1<uses-permission android:name="android.permission.VIBRATE" />
HapticFeedback you need to import
services.dart by adding the following line to your file:
After you add the above import you can use the
HapticFeedback class. Probably the most obvious method in the class is the
There's also a few other methods that you can use, which cause a vibration(or a 'feedback sensation') at various different levels:
And another method that simulates selection feedback:
And if you're looking for something a bit more advanced you could also checkout the
vibration package on pub.dev.