vibrate 0.0.1

  • Example
  • Installing
  • Versions
  • 47

Vibrate #

A Flutter plugin to vibrate the device.

Usage #

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

Example #

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

[0.0.1] - January 24th, 2018.

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


import 'package:flutter/material.dart';
import 'package:flutter/services.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;

  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")),

Use this package as a library

1. Depend on it

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

  vibrate: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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.4 Aug 22, 2018 Go to the documentation of vibrate 0.0.4 Download vibrate 0.0.4 archive
0.0.3 Jul 10, 2018 Go to the documentation of vibrate 0.0.3 Download vibrate 0.0.3 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
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.