Pub.dev Package: Link
GitHub Repository: Link
Imagine getting into a serious car crash in a remote area—a mountain pass, a highway dead zone, or a rural road with zero cell signal.
You open your safety app, or its automated background trigger fires... only to hang indefinitely because it relies on a cloud API to process sensor data or verify the crash.
That single point of failure bugged me for months. Emergency safety features shouldn’t depend on a stable 5G connection. If an engine can detect a crash instantly via onboard physics, our software should be able to do the same on-device.
So, I built and open-sourced ** offline_sos_system**—a pure Dart, 100% offline crash detection engine powered by on-device TensorFlow Lite.
Most existing Flutter solutions for safety or impact detection suffer from one of three issues:
G-force > X
spikes, leading to massive false-positive rates (like dropping your phone on a table or hitting a pothole).I wanted a solution that was pure Dart/Flutter at the developer layer, handled complex multi-axis motion patterns via Edge AI, and never made a single network request.
The package handles the entire pipeline locally on the device:
tflite_flutter
.Here is how simple it is to initialize and listen for crash events in Flutter:
dart
import 'package:offline_sos_system/offline_sos_system.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize the offline SOS engine
final sosEngine = OfflineSosSystem();
await sosEngine.initialize();
// Listen to real-time crash detection events
sosEngine.crashStream.listen((CrashEvent event) {
if (event.isCrashDetected) {
print('CRASH DETECTED!');
print('Confidence Score: ${event.confidence}');
print('Impact Force: ${event.gForce}G');
// Trigger your app's local emergency protocols here
}
});
// Start monitoring sensor telemetry
await sosEngine.startMonitoring();
}