How pschkllr/flutter_true_time works
flutter_true_time is a Flutter package for network-derived UTC readings, with a Flutter-independent timing engine. The principal workflow is app initialization, source sampling and synchronization, anchoring timestamps to a monotonic clock, then returning readings with freshness and uncertainty evidence; optional persistence supports guarded offline restoration. The README documents platform-specific epoch evidence and browser endpoint requirements. Dart implementation excerpts were not supplied, so internal edges below are limited to documented relationships; the Android bootstrap behavior is directly visible in its excerpt.
Main entry points: engine.dart Sync engine · facade.dart TrueTime facade · sources.dart Time sources · clock.dart Monotonic clock
Components 26
Public API
- TrueTime facade
lib/src/facade.dart - Flutter exports
lib/flutter_true_time.dart - Core exports
lib/core.dart - Reading models
lib/src/models.dart
Synchronization
- Sync engine
lib/src/engine.dart - Time sources
lib/src/sources.dart - Provider grouping
lib/src/provider_group.dart - Cancellation
lib/src/cancellation.dart
Clock and state
- Monotonic clock
lib/src/clock.dart - Native clock
lib/src/clock_native.dart - Portable clock
lib/src/clock_portable.dart - Anchor persistence
lib/src/persistence.dart - Secure storage
lib/src/secure_store.dart - Diagnostics
lib/src/diagnostics.dart
Platform adapters
- Platform epoch
lib/src/epoch_platform.dart - I/O epoch
lib/src/epoch_io.dart - Portable epoch
lib/src/epoch_portable.dart - Native NTP
lib/src/ntp_io.dart - NTP stub
lib/src/ntp_stub.dart - Dart plugin bridge
lib/flutter_true_time_dart_plugin.dart - Web plugin
lib/flutter_true_time_web.dart - Android epoch bridge
android/src/main/java/dev/pschkllr/flutter_true_time/FlutterTrueTimePlugin.java
Other components
- Flutter app
- Android boot metadata
- Configured NTP servers
- HTTPS date endpoints
Connections 19
- Flutter app → TrueTime facade: initializes and reads
README.md - TrueTime facade → Sync engine: starts sync
README.md - TrueTime facade → Sync engine: waits for readiness
README.md - TrueTime facade → Sync engine: reads estimate
README.md - Sync engine → Time sources: samples sources
- Time sources → Configured NTP servers: queries defaults
README.md - Time sources → HTTPS date endpoints: uses configured endpoints
README.md - Sync engine → Anchor persistence: restores and saves anchors
README.md - Sync engine → Monotonic clock: anchors timestamps
README.md - TrueTime facade → Diagnostics: exposes status
- Sync engine → Cancellation: cancels owned work
README.md - Anchor persistence → Secure storage: uses storage
- Monotonic clock → Native clock: selects native clock
- Monotonic clock → Portable clock: selects portable clock
- Platform epoch → I/O epoch: uses I/O provider
- Platform epoch → Portable epoch: uses portable provider
- Sync engine → Platform epoch: checks epoch evidence
README.md - Android epoch bridge → Android boot metadata: reads boot count; stores installation marker
android/src/main/java/dev/pschkllr/flutter_true_time/FlutterTrueTimePlugin.java - Native NTP → Configured NTP servers: queries servers