vibration 0.0.5 vibration: ^0.0.5 copied to clipboard
A plugin for handling Vibration API on iOS and Android devices
Vibration #
A plugin for handling Vibration API on iOS and Android devices.
Getting Started #
-
Add
vibration
to the dependencies section ofpubspec.yaml
.dependencies: vibration: git: url: git@github.com:benjamindean/flutter_vibration.git
-
Import package:
import 'package:vibration/vibration.dart';
Methods #
Vibration.hasVibrator() #
Used to check if the target device has vibration capabilities. Returns bool
.
Vibration.vibrate(...) #
Vibration.vibrate(duration: [int], pattern: [List<int>], repeat: [int])
Vibrate device for a certain duration or by pattern. Default duration is 500ms.
Vibration.cancel() #
Stop ongoing vibration.
Android #
Supports vibration with duration and pattern. On Android 8 (Oreo) and above, uses the VibrationEffect class. For the rest of the usage instructions, see Vibrator class documentation.
iOS #
Only supports singular vibrations with 500ms duration.