start method
void
start()
Subscribes to the accelerometer for the train-detection fallback. Idempotent — calling twice is a no-op.
Implementation
void start() {
if (_accelSub != null) return;
// sensors_plus 7.x — `accelerometerEventStream` is the supported
// accessor; the deprecation note guards 4.x→7.x users while we
// sit on the bridge.
try {
// ignore: deprecated_member_use
_accelSub = accelerometerEvents.listen(
_onAccel,
onError: (Object e) {
if (kDebugMode) {
debugPrint('🦎 Morph GPS: accelerometer error: $e');
}
},
);
} catch (_) {
// Sensor not available (iOS simulator, some emulators) —
// fallback fusion is silently skipped.
}
}