ImpactConfig class

Crash & fall detection.

When enableCrashDetection is true, a corroborated high-g impact while moving raises a potential_crash (with a confirmWindowMs cancel countdown) that auto-confirms to crash unless cancelled — delivered via Tracelet.onImpact. enableFallDetection adds best-effort personal-fall detection (more false positives; default off).

Default: disabled. Tracelet provides the trigger + cancel window; it never places emergency calls.

Annotations

Constructors

ImpactConfig({bool enableCrashDetection = false, bool enableFallDetection = false, double crashGThreshold = 2.0, double crashMinSpeedKmh = 25.0, double fallGThreshold = 2.5, int confirmWindowMs = 15000, double minImpactConfidence = 0.6, String? crashModelUrl, String? crashModelSha256, double crashModelThreshold = 0.5, String? crashModelUnlockUrl, String? crashModelLicenseKey})
Creates a new ImpactConfig.
const
ImpactConfig.fromMap(Map<String, Object?> map)
Creates an ImpactConfig from a map.
factory

Properties

confirmWindowMs int
Countdown (ms) before a candidate auto-confirms. Default 15000.
final
crashGThreshold double
Impact magnitude (g) for a crash candidate. Default 2.0 (lowered from 3.0 after a field-data study found 3.0 g missed ~half of real crashes; the cancel-countdown offsets the extra false alarms).
final
crashMinSpeedKmh double
Pre-impact speed (km/h) required to corroborate a crash. Default 25.
final
crashModelLicenseKey String?
Customer license key presented to crashModelUnlockUrl. Bound to your app (package/bundle id) and signed by you; never grants access on its own — the endpoint validates it before returning the key.
final
crashModelSha256 String?
Optional SHA-256 (hex) of the encrypted model blob for integrity verification after download. Recommended whenever crashModelUrl is set.
final
crashModelThreshold double
Probability threshold (0..1) at which the ML model flags a crash. Default 0.5. Use the rf_probability_threshold from the model's training report.
final
crashModelUnlockUrl String?
Optional licensing unlock endpoint (e.g. a Cloudflare Worker). When set with crashModelLicenseKey, the SDK POSTs the license to this URL to fetch the decryption key + model URL at runtime, instead of the host injecting the key manually. The key is held in memory only. null ⇒ no auto-unlock.
final
crashModelUrl String?
Optional URL of an AES-256-GCM encrypted crash ML model (the portable random-forest JSON). When set (and crash detection is enabled), the SDK downloads it once, verifies crashModelSha256, decrypts and runs it to score impacts; it falls back to the rule engine if absent/offline. The model is opt-in and downloaded — never embedded — so the base SDK size is unchanged. null ⇒ pure rule engine (default). The decryption key is supplied by the host at build/run time, never via this config.
final
enableCrashDetection bool
Master switch for vehicle crash detection.
final
enableFallDetection bool
Personal fall detection (best-effort; default false).
final
fallGThreshold double
Impact magnitude (g) for a fall candidate. Default 2.5.
final
hashCode int
The hash code for this object.
no setteroverride
minImpactConfidence double
Suppress candidates below this confidence. Default 0.6.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, Object?>
Serializes to a map.
toString() String
A string representation of this object.
inherited
toTlConfig() → TlImpactConfig
Converts to Pigeon TlImpactConfig.

Operators

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