vibrate 0.0.2

  • Example
  • Installing
  • Versions
  • 91


pub package A Flutter plugin to vibrate the device.


To use this plugin, add vibrate as a dependency in your pubspec.yaml file.

Make sure you add the following permissions to your Android Manifest

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


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

// 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 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

[0.0.2] - January 26th, 2018.

  • added vibrateWithPauses(Iterable<Duration> pauses)

[0.0.1] - January 24th, 2018.

  • vibrate() and canVibrate() implemented on iOS and Android


import 'package:flutter/material.dart';
import 'package:vibrate/vibrate.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {

  bool _canVibrate = true;
  final Iterable<Duration> pauses = [
    const Duration(milliseconds: 500),
    const Duration(milliseconds: 1000),
    const Duration(milliseconds: 500),

  initState() {

  init() async{
    bool canVibrate = await Vibrate.canVibrate;
    setState((){_canVibrate = canVibrate;});

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(title: new Text('Plugin example app')),
        body: new Center(
          child: new Column(
            children: <Widget>[
              new ListTile(
                leading: new Icon(Icons.vibration, color: Colors.teal),
                onTap: _canVibrate ?(){Vibrate.vibrate();} : null,
                title: new Text("Vibrate")),
              new ListTile(
                  leading: new Icon(Icons.vibration, color:,
                  onTap: _canVibrate ?(){Vibrate.vibrateWithPauses(pauses);} : null,
                  title: new Text("Vibrate with pauses")),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  vibrate: "^0.0.2"

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:vibrate/vibrate.dart';
Version Uploaded Documentation Archive
0.0.2 Jan 26, 2018 Go to the documentation of vibrate 0.0.2 Download vibrate 0.0.2 archive
0.0.1 Jan 24, 2018 Go to the documentation of vibrate 0.0.1 Download vibrate 0.0.1 archive


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3
  • Flutter: 0.5.2


Describes how popular the package is relative to other packages. [more]
85 / 100
Code health derived from static analysis. [more]
96 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run flutter format to format lib/vibrate.dart.


Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.10
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7