ShakeDetector class
Detects phone shake using sensors_plus accelerometer.
Usage:
final detector = ShakeDetector();
detector.startListening(() => print('shaken!'));
// ...
detector.stopListening();
Constructors
- ShakeDetector({double shakeThresholdGravity = 2.7, int shakeCooldownMs = 1000})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shakeCooldownMs → int
-
Minimum milliseconds between two shake events.
final
- shakeThresholdGravity → double
-
Acceleration magnitude (in G-forces) that triggers a shake.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startListening(
VoidCallback onShake) → void -
stopListening(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited