A flutter plugin for device vibration and haptic feedback.

Last update: Apr 14, 2022

Buy Me A Coffee Donate github pages GitHub stars flutter_vibrate

Vibrate

A Flutter plugin to vibrate the device. This uses all the current Haptic Feedback APIs from Apple and provides similar feedback on Android.

Getting Started

Make sure you add the following permissions to your Android Manifest

<uses-permission android:name="android.permission.VIBRATE"/>

Usage

// Import package
import 'package:flutter_vibrate/flutter_vibrate.dart';

Vibration

// Check if the device can vibrate
bool canVibrate = await Vibrate.canVibrate;

// Vibrate
// Vibration duration is a constant 500ms because
// it cannot be set to a specific duration on iOS.
Vibrate.vibrate();

// Vibrate with pauses between each vibration
final Iterable<Duration> pauses = [
    const Duration(milliseconds: 500),
    const Duration(milliseconds: 1000),
    const Duration(milliseconds: 500),
];
// vibrate - sleep 0.5s - vibrate - sleep 1s - vibrate - sleep 0.5s - vibrate
Vibrate.vibrateWithPauses(pauses);

Haptic Feedback

// Choose from any of these available methods
enum FeedbackType {
  success,
  error,
  warning,
  selection,
  impact,
  heavy,
  medium,
  light
}

var _type = FeedbackType.impact;
Vibrate.feedback(_type);

Documentation

Android

https://developer.android.com/reference/android/view/HapticFeedbackConstants

iOS

https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/feedback/

GitHub

https://github.com/rodydavis/flutter_vibrate
Comments
  • 1. Update Android Dependencies

    Update Build Gradle

    Changes

    • Update the build gradle to target a higher android version and to use a higher version of the build tools to prevent errors in linking release build.
    Reviewed by dwach414 at 2019-12-04 21:47
  • 2. Migrate to android v2 embedding

    There is a warning regarding the v2 migration during every flutter build, even just on pub get.

    The other plugins were really quick with updates - this is (for me) the last plugin that hasn't been updated yet. A new version on pub.dev would be great! :)

    This PR fixes it.

    Reviewed by nohli at 2021-09-17 23:34
  • 3. Fix deprecation warnings

    During every Android build flutter_vibrate triggers a warning about deprecation.

    See void vibrate() on https://developer.android.com/reference/android/os/Vibrator

    https://stackoverflow.com/questions/45605083/android-vibrate-is-deprecated-how-to-use-vibrationeffect-in-android-api-26

    Reviewed by nohli at 2020-09-14 19:54
  • 4. Renamed from vibrate to flutter_vibrate in a few locations to fix iOS…

    … build

    Before these changes, the iOS build failed with the following error:

    Fetching podspec for `flutter_vibrate` from `.symlinks/plugins/flutter_vibrate/ios`
    [!] No podspec found for `flutter_vibrate` in `.symlinks/plugins/flutter_vibrate/ios`
    
    Reviewed by miguelcmedeiros at 2020-03-04 20:00
  • 5. use google() maven for better network accessibility

    According to gradle issue #2151, https://maven.google.com is blocked in china, use google() instead.

    Currently, we are suffering from this issue in china😂

    Reviewed by TechAilurus at 2021-02-20 02:24

Related

A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your issue.
A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your issue.

r_scan A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your iss

May 24, 2022
A Demo application📱 which stores User feedback from 💙Flutter application into Google Sheets🗎 using Google AppScript.
A Demo application📱  which stores User feedback from 💙Flutter application into Google Sheets🗎 using Google AppScript.

?? Flutter ?? to Google Sheets ?? A Demo application which stores User feedback from Flutter application into Google Sheets using Google AppScript. Yo

May 18, 2022
Resource monitor - A flutter plugin for Android and IOS to monitor CPU and RAM usage of device.

resource_monitor A flutter plugin for Android and IOS to monitor CPU and RAM usage of device. TODO Return overall system cpu/memory usage. Implement A

Jan 4, 2022
A Flutter plugin for iOS and Android allowing access to the device cameras.

Camera Plugin A Flutter plugin for iOS and Android allowing access to the device cameras. Note: This plugin is still under development, and some APIs

Mar 17, 2020
A Flutter plugin for Android and iOS allowing access to the device cameras, a bit deeper!!

flutter_cameraview A Flutter plugin for Android and iOS allowing access to the device cameras, a bit deeper!!. This plugin was created to offer more a

Sep 13, 2021
Flutter plugin that allows you to keep the device screen awake on Android, iOS, macOS, Windows, and web.

Wakelock Wakelock is Flutter plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping. Supported platforms Platfo

May 10, 2022
A Flutter plugin for iOS and Android allowing access to the device cameras.

A Flutter plugin for iOS and Android allowing access to the device cameras.

May 6, 2022
A Flutter plugin to request the device unlock screen.

device_unlock A Flutter plugin to request the device unlock screen on Android and iOS. How does it work The following attempts and fallbacks are made:

May 11, 2022
Flutter Plugin used to query audios/songs infos [title, artist, album, etc..] from device storage.
Flutter Plugin used to query audios/songs infos [title, artist, album, etc..] from device storage.

on_audio_query on_audio_query is a Flutter Plugin used to query audios/songs ?? infos [title, artist, album, etc..] from device storage. Help: Any pro

May 20, 2022
Flutter-Shared-Preference - The goal is to learn how to use the shared preferences plugin to save important pieces of information to your device.
Flutter-Shared-Preference - The goal is to learn how to use the shared preferences plugin to save important pieces of information to your device.

Recipe Finder The goal is to learn how to use the shared preferences plugin to save important pieces of information to your device. Final App UI Resou

Jan 1, 2022
System info plus - A Flutter plugin to get device Random Access Memory (RAM) size

system_info_plus A Flutter plugin to get device Random Access Memory (RAM) size.

Jan 10, 2022
Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.
Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.

Flutter Tutorial - Upload Files To Firebase Storage Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your devic

May 2, 2022
A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity
A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity

Flutter Ready to Go A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity. Why

May 17, 2022
A responsive scaffold widget that adjusts to your device size, for your flutter mobile and web apps.
A responsive scaffold widget that adjusts to your device size, for your flutter mobile and web apps.

scaffold_responsive A responsive scaffold widget that adjusts to your device size, for your flutter mobile and web apps. Check out the Live demo here

Dec 16, 2021
A simple flutter app that downloads a file from the internet, shows a custom-made download progress dialog and saves the file to device's internal storage

http_downloader A simple flutter app that downloads a file from the internet using the http plugin. It has a custom-designed progress dialog which dis

Apr 6, 2021
Sexy and beautiful wallpapers for your Android-powered device! :black_heart:
Sexy and beautiful wallpapers for your Android-powered device! :black_heart:

BLACK UNICORN WALLPAPERS ?? Sexy and beautiful wallpapers for your Android-powered device! ?? About ?? I've always wanted to write an app that had sex

Apr 20, 2022
Approximate how your app looks and performs on another device.
Approximate how your app looks and performs on another device.

Approximate how your app looks and performs on another device. Main features Preview any device from any device Change the device orientation Dynamic

May 21, 2022
Backs up Android devices on Linux, macOS and Windows. Backup your device without vendor lock-ins, using insecure software or root.

Backs up Android devices on Linux, macOS and Windows. Backup your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box.

May 15, 2022