HapticVibration class final
Plays haptic Morse sequences on the device motor.
This is the only part of the package that depends on Flutter and on
package:vibration; it lives in a separate library so the encoder stays
usable from plain Dart:
import 'package:haptic_morse/haptic_morse_vibration.dart';
const haptics = HapticVibration();
await haptics.vibrateText('SOS');
Supported on Android and iOS only.
- Annotations
Constructors
- HapticVibration()
-
Creates a vibration controller.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancel(
) → Future< void> - Cancel any ongoing vibration.
-
hasAmplitudeControl(
) → Future< bool> - Whether the device can vary vibration strength.
-
hasCustomVibrationsSupport(
) → Future< bool> - Whether the device can play a custom waveform.
-
hasVibrator(
) → Future< bool> - Whether the device has a vibration motor at all.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
vibrate(
{int duration = 500, List< int> pattern = const [], int repeat = -1, List<int> intensities = const [], int amplitude = -1, double sharpness = 0.5}) → Future<void> - Vibrate with the given parameters.
-
vibrateEvents(
List< HapticEvent> events, {int amplitude = -1, double sharpness = 0.5}) → Future<void> - Plays an existing haptic sequence.
-
vibrateText(
String text, {HapticMorse morse = const HapticMorse(), int amplitude = -1, double sharpness = 0.5}) → Future< void> -
Converts
textto Morse and plays it.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited