Pulsar class

Entry point for the Pulsar haptics library.

Create one instance and reuse it throughout your app:

final pulsar = Pulsar();
pulsar.getPresets().systemImpactMedium();
pulsar.getRealtimeComposer().set(0.8, 0.5);

Constructors

Pulsar()
Creates a new Pulsar instance. Reuse a single instance throughout your app.

Properties

hashCode int
The hash code for this object.
no setterinherited
presets PulsarPresets
Access to the 200+ built-in haptic presets.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

canPlayHaptics() Future<bool>
Returns true if the device can play haptics right now (hardware capable and not muted by the user).
clearCache() Future<void>
Evict all cached preset data from memory.
createAdaptiveHaptics(AdaptivePreset preset) Future<AdaptiveHaptics>
Creates an AdaptiveHaptics instance for the given preset.
enableCache(bool state) Future<void>
Enable or disable preset caching. When enabled, parsed patterns are kept in memory to reduce latency on repeated playback.
enableHaptics(bool state) Future<void>
Enable or disable haptic output globally. Defaults to true.
enableImpulseCompositionMode(bool state) Future<void>
Android only — enables impulse composition mode.
enableSound(bool state) Future<void>
Enable or disable audio simulation fallback. Defaults to true.
forceHapticsSupportLevel(HapticSupport level) Future<void>
Override haptic support level (useful for testing). Android only.
getPatternComposer() PulsarPatternComposer
Native-style accessor for a fresh pattern composer.
getPresets() PulsarPresets
Native-style accessor for built-in haptic presets.
getRealtimeComposer({RealtimeComposerStrategy? strategy}) PulsarRealtimeComposer
Native-style accessor for the realtime composer.
hapticSupport() Future<HapticSupport>
Returns the device's haptic support level.
isCacheEnabled() Future<bool>
Returns true if preset caching is currently enabled.
isHapticsEnabled() Future<bool>
Returns true if haptics are currently enabled via enableHaptics.
isHapticsSupported() Future<bool>
Returns whether the current device supports haptics at all.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preloadPreset(String presetName) Future<void>
Pre-parse presetName so it is ready for low-latency playback.
preloadPresets(List<String> presetNames) Future<void>
Pre-parse multiple presets by name for low-latency playback.
setRealtimeComposerStrategy(RealtimeComposerStrategy strategy) Future<void>
Android only — sets the realtime composer strategy.
shutDownEngine() Future<void>
iOS only — shuts down the CoreHaptics engine. No-op on Android.
stopHaptics() Future<void>
Stop any currently playing haptic immediately.
toString() String
A string representation of this object.
inherited

Operators

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