How to continuously vibrate phone in both android and IOS using flutter

Issue

I am using vibration: ^1.7.5 package in which we have to specify the time in milliseconds.

I am now using this to vibrate the device till 10 minutes
Vibration.vibrate(duration: 600000, amplitude: 255);

but is there any way by which we can keep vibrating the device continuously until
we want?

Solution

You can use repeat with a pattern like below which will continue the vibration until cancelled.

Vibration.vibrate(pattern: [100, 200, 400], repeat: 1)

Link to the source
Github Link

Answered By – Srini

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published