Search code examples
flutterdartvibration

How to implement vibration with Flutter for both Android and iOS?


Using Flutter I am trying to implement vibration on a button click.

I find it surprisingly difficult to be honest. I've tried using the following packages unsuccessfully: vibration and vibrate but they just do not vibrate (talking here about the real devices not emulators/simulators).

Is there a guide with clear examples on how to implement vibration on iOS and Android devices with Flutter?

Thanks, Mihai


Solution

  • Found a way using HapticFeedback.vibrate(). It works for both iOS and Android. See more details with code example and other settings on this [post][1]: Flutter: How to use HapticFeedback