tracelet 0.2.4
tracelet: ^0.2.4 copied to clipboard
Production-grade background geolocation for Flutter. Battery-conscious tracking, geofencing, SQLite persistence, HTTP sync, and headless execution for iOS & Android.
example/main.dart
// ignore_for_file: avoid_print
import 'package:tracelet/tracelet.dart' as tl;
/// Minimal example demonstrating Tracelet background geolocation.
Future<void> main() async {
// 1. Subscribe to location events.
tl.Tracelet.onLocation((location) {
print(
'๐ ${location.coords.latitude}, ${location.coords.longitude} '
'ยท accuracy: ${location.coords.accuracy}m',
);
});
// 2. Initialize the plugin with a configuration.
final state = await tl.Tracelet.ready(tl.Config(
geo: tl.GeoConfig(
desiredAccuracy: tl.DesiredAccuracy.high,
distanceFilter: 10,
),
logger: tl.LoggerConfig(logLevel: tl.LogLevel.verbose),
));
print('Tracelet ready โ enabled: ${state.enabled}, '
'tracking: ${state.trackingMode}');
// 3. Start tracking.
await tl.Tracelet.start();
}