Skip to content

Implementing Vibration in Flutter

Flutter, Dart, Flutter Tips1 min read

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...

Add permission to AndroidManifest.xml

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" />

The HapticFeedback class

To use HapticFeedback you need to import services.dart by adding the following line to your file:

1import 'package:flutter/services.dart';

After you add the above import you can use the HapticFeedback class. Probably the most obvious method in the class is the vibrate method:


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