# fluttertpc_flutter_vibrate
**Repository Path**: openharmony-sig/fluttertpc_flutter_vibrate
## Basic Information
- **Project Name**: fluttertpc_flutter_vibrate
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 4
- **Created**: 2024-11-11
- **Last Updated**: 2025-05-07
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 🚨 **重要提示 | IMPORTANT**
>
> **⚠️ 此代码仓已归档。新地址请访问 [fluttertpc_flutter_vibrate](https://gitcode.com/openharmony-sig/fluttertpc_flutter_vibrate)。| ⚠️ This repository has been archived. For the new address, please visit [fluttertpc_flutter_vibrate](https://gitcode.com/openharmony-sig/fluttertpc_flutter_vibrate).**
>
---
>
[](https://www.buymeacoffee.com/rodydavis)
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WSH3GVC49GNNJ)

[](https://github.com/rodydavis/flutter_vibrate)
[](https://pub.dev/packages/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
``` xml
```
## Usage
``` dart
// Import package
import 'package:flutter_vibrate/flutter_vibrate.dart';
```
### Vibration
``` 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.vibrate();
// Vibrate with pauses between each vibration
final Iterable 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
``` dart
// 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/