vibration 0.0.1
vibration: ^0.0.1 copied to clipboard


Handle vibration on iOS and Android

Vibration #

Build Status

A plugin for handling Vibration API in Flutter apps.

Getting Started #

  1. Add vibration to the dependencies section of pubspec.yaml.

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