allinone_location 4.1.2
allinone_location: ^4.1.2 copied to clipboard
Enterprise Flutter location SDK featuring Fused Location, Kalman smoothing, adaptive engines, geofencing, background recovery, diagnostic UI, and offline sync.
allinone_location #
allinone_location is a high-precision, enterprise-grade Flutter Location SDK designed for production tracking, navigation, battery efficiency, geofencing, background service resilience, and offline data sync.
Built with zero external binary dependencies (pure Dart + standard Flutter plugins), allinone_location combines Google Fused Location, 2D Kalman smoothing, route smoothing, speed/heading/bearing/altitude processing, dead reckoning prediction, auto-pause battery saving, GPX/CSV exporting, two-tier reverse geocoding caching, and self-healing watchdog supervision into a unified, high-performance package.
๐ Multi-Platform Support Matrix #
| Platform | Location Fixes | Background Tracking | Offline Queue | Diagnostic UI |
|---|---|---|---|---|
| Android (8.0โ15+) | โ Google Fused GPS | โ Foreground Service | โ SharedPreferences | โ Pre-built Widget |
| iOS (12.0โ18+) | โ CoreLocation | โ Background Modes | โ SharedPreferences | โ Pre-built Widget |
| Web | โ HTML5 Geolocation | โ ๏ธ Tab Scope | โ LocalStorage | โ Pre-built Widget |
| macOS | โ CoreLocation | โ Background Daemon | โ SharedPreferences | โ Pre-built Widget |
| Windows | โ WinRT Location | โ Background Worker | โ SharedPreferences | โ Pre-built Widget |
| Linux | โ GeoClue2 | โ Daemon Service | โ SharedPreferences | โ Pre-built Widget |
๐ Performance Benchmarks (Full Reproducible Report) #
Every release is continuously stress-tested against extreme data throughput. Measured benchmark results on standard Flutter runtime:
| Benchmark Test Scenario | Workload Size | Execution Time | Metric |
|---|---|---|---|
| Pipeline Throughput | 10,000 Location Fixes | 96 ms | 9.65 ยตs / point |
| Geofence Scaling | 1,000 Regions $\times$ 1,000 Locations | 43 ms | 1,000,000 Spatial Checks |
| RDP Route Compression | 5,000 GPS Points | 4 ms | 100% Noise Reduction |
| 2D Route Smoothing | 5,000 GPS Points | 9 ms | Moving Average $O(N)$ |
| Distance Matrix | 50 $\times$ 50 ($2,500$ Pairs) | < 1 ms | $2,500$ Pairs Computed |
| Heatmap Grid Binning | 10,000 Points | 20 ms | $10,000$ Grid Cells |
| Offline Queue Batching | 1,000 Enqueued / 500 Dequeued | 54 ms | Batched Storage Operations |
See BENCHMARKS.md for full hardware details and methodology.
โก Comparison vs Existing Packages #
| Feature | geolocator |
location |
allinone_location |
|---|---|---|---|
| Fused GPS Location Fixes | โ | โ | โ Multi-sample Weighted Centroid ($1/\sigma^2$) |
| 2D Kalman & Route Smoothing | โ | โ | โ Kalman + Bezier + Moving Average |
| Speed Engine & Acceleration Trends | โ | โ | โ Moving Average + EMA + Trend |
| Altitude Spike Rejection & Elevation Gain | โ | โ | โ Median + EMA Filter & Gain/Loss |
| Dead Reckoning Outage Prediction | โ | โ | โ Speed + Bearing Prediction |
| Auto-Pause Battery Saver | โ | โ | โ Motion Activity Classification |
| Circle & Polygon Geofencing | โ | โ | โ With Dwell & Hysteresis Anti-Flapping |
| Offline Queue & Batch Sync | โ | โ | โ FIFO Queue + SharedPreferences Disk |
| Self-Healing Background Watchdog | โ | โ | โ Boot Auto-Start + State Recovery |
| GPX 1.1 XML & CSV Exporters | โ | โ | โ Pure Offline Generators |
| Distance Matrix & Travel Time ETA | โ | โ | โ Pure Offline Haversine Math |
| Reverse Geocoding Cache | โ | โ | โ Two-Tier LRU Memory + Disk Cache |
| Diagnostic Dashboard Widget | โ | โ | โ Pre-built Flutter UI Debugger |
๐ Architecture Overview #
graph TD
A[GPS Hardware / Fused Location] --> B[AllInOneLocationSDK / AllInOneLocationService]
B --> C[Mock Location Detector]
B --> D[Motion Detector & Activity Classification]
B --> E[Indoor/Outdoor Engine]
B --> F[Speed, Heading & Bearing Engines]
B --> G[Altitude Filter & Gain/Loss Engine]
B --> H[2D Kalman & Route Smoother]
B --> I[Dead Reckoning Predictor]
B --> J[Auto-Pause Engine]
H --> K[AllInOneLocation Object]
I --> K
K --> L[Smart Geofence Manager]
K --> M[Offline Location Queue & Sync Manager]
K --> N[Crash Recovery Manager]
K --> O[Developer Diagnostic Dashboard Widget]
๐ Quick Start & Examples #
1. Unified SDK Access (AllInOneLocationSDK) #
Access all sub-engines through a single static facade:
import 'package:allinone_location/allinone_location.dart';
// Single entry point facade accessors
final geofences = AllInOneLocationSDK.geofences;
final analytics = AllInOneLocationSDK.analytics;
final offlineSync = AllInOneLocationSDK.offlineSync;
final geocoding = AllInOneLocationSDK.geocoding;
final crashRecovery = AllInOneLocationSDK.crashRecovery;
final speedEngine = AllInOneLocationSDK.speedEngine;
2. Request Permissions #
import 'package:allinone_location/allinone_location.dart';
Future<void> requestPermissions() async {
final granted = await AllInOnePermission.requestAllPermissions();
if (granted) {
print('โ
Location & notification permissions granted!');
}
}
3. High-Accuracy Multi-Sample Centroid Fix #
final location = await AllInOneLocationService.getCurrentLocation(
config: const AllInOneConfig(
sampleCount: 3,
enableKalmanFilter: true,
enableSpeedEngine: true,
enableAltitudeFiltering: true,
),
);
print('Lat: ${location.latitude}, Lng: ${location.longitude}');
print('Filtered Altitude: ${location.filteredAltitude}m');
print('Confidence Score: ${location.confidenceScore}%');
4. Polygon & Circle Geofencing #
final geofenceManager = AllInOneLocationSDK.geofences;
// Add Circle Region
geofenceManager.addRegion(GeofenceRegion.circle(
id: 'hq_office',
centerLatitude: 12.9716,
centerLongitude: 77.5946,
radiusMeters: 100.0,
dwellDuration: const Duration(minutes: 2),
hysteresisMeters: 5.0,
));
// Listen to enter, exit, and dwell events
geofenceManager.onGeofenceEvent.listen((event) {
print('๐ฉ Geofence [${event.geofenceId}] event: ${event.type.name}');
});
5. Export Route to GPX 1.1 XML & CSV #
List<AllInOneLocation> routePoints = [...];
// Export to GPX XML
final gpxString = GpxExporter.export(routePoints, trackName: 'Site Survey Route');
// Export to CSV
final csvString = CsvExporter.export(routePoints);
6. Background Tracking Service #
await AllInOneBackgroundService.initialize(
config: const BackgroundConfig(
notificationTitle: 'Site Worker Tracking',
notificationContent: 'Active high-precision background tracking',
heartbeatIntervalSeconds: 15,
enableOfflineQueue: true,
enableGeofencing: true,
),
);
await AllInOneBackgroundService.startService();
๐ Community & Contribution #
We welcome contributions! Please review our Contributing Guide and Code of Conduct.
To run unit & performance benchmark tests locally:
cd packages/allinone
flutter test
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.