AdvancedHapticsPlatform class abstract

The interface that platform implementations of advanced_haptics must implement.

Platform implementations should extend this class rather than implement it, so that newly added methods with default behaviour do not break them.

Apps can replace instance with a mock in tests to observe or silence haptic calls.

Inheritance
  • Object
  • PlatformInterface
  • AdvancedHapticsPlatform
Implementers

Constructors

AdvancedHapticsPlatform()
Constructs an AdvancedHapticsPlatform.

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

arePrimitivesSupported({required List<int> ids}) → Future<bool>
Whether the device can play every Android primitive in ids.
cancel() → Future<void>
Cancels any playing or scheduled haptic immediately.
hasCustomHapticsSupport() → Future<bool>
Whether the device supports custom (amplitude-controlled) haptics.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause({double atTime = 0.0}) → Future<void>
Pauses the active player.
playAhap({required String path, double atTime = 0.0}) → Future<void>
Plays an Apple Core Haptics .ahap file located at asset path.
playComposition({required List<Map<String, Object?>> primitives, required List<int> timings, required List<int> amplitudes}) → Future<void>
Plays Android composition primitives (serialised AndroidPrimitiveEvents), with a pre-flattened waveform fallback.
playPattern({required List<Map<String, Object?>> events, required List<int> timings, required List<int> amplitudes, double atTime = 0.0}) → Future<void>
Plays a events timeline (serialised HapticEvents sorted by time), with a pre-flattened waveform (timings/amplitudes) for platforms and devices that cannot render the events natively.
playPredefined({required int effectId}) → Future<void>
Plays an Android predefined vibration effect identified by effectId.
playWaveform({required List<int> timings, required List<int> amplitudes, int repeat = -1, double atTime = 0.0}) → Future<void>
Plays a waveform made of timings (milliseconds) and amplitudes (0-255). Both lists have already been validated by the public API.
resume({double atTime = 0.0}) → Future<void>
Resumes the active player.
seek({required double offset}) → Future<void>
Seeks the active player to offset seconds.
stop({double atTime = 0.0}) → Future<void>
Stops any playing haptic.
success() → Future<void>
Plays the built-in "success" pattern.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance ↔ AdvancedHapticsPlatform
The default instance of AdvancedHapticsPlatform to use.
getter/setter pair