flutter_ntp
A small, fast NTP (Network Time Protocol) client for Flutter and Dart with built-in offset caching.
0.1.0
2.8K downloads/mo
#4769 most downloaded on pub.dev
mustafa-707/flutter_ntp
What this package is like to depend on
Last release 3 months ago
25 May 2026
Too new to tell
only 2 release windows
Nearly every release is documented
notes for 3 of 3 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
3 releases · first in 2024
1 release in the last 12 months
see the full history below
Release timeline
3 releases · Jun 2024 to May 2026
2025
2026
Releases
latest 3-
0.1.025 May 2026Release notes
Open source →- Fix: the cache was effectively never hit. The previous code stored the
NTP offset as the cached value and later interpreted it as a
microsecondsSinceEpochfor the "cached at" timestamp, so the freshness check comparednow()against a date near 1970 and always thought the cache was stale. Cache now tracks(offset, syncedAt, server)correctly, so subsequentnow()calls are instant until the cache expires. - Fix:
encodeTimestampoverwrotearray[7]with a random byte on every call, corrupting therootDelayfield of the outgoing packet. The random byte is now written to the last byte of the transmit timestamp as RFC 5905 §3 suggests for spoofing resistance. - Fix: wire format rewritten with
ByteData(no more double-precision arithmetic on 64-bit fixed-point timestamps), removing the subtle precision loss from the previouspow(2.0, ...)decoder. - Fix: removed duplicate
NtpServerentries (ntpPool/pool,milUsno/usno, etc.). - API: new
FlutterNTP.sync()performs a one-shot round-trip and caches the offset; newFlutterNTP.nowSync()returns the corrected time without any I/O.FlutterNTP.now()keeps its old signature but gainsforceRefreshandallowFallbackflags, plus optionalserver. - API: typed
NtpExceptioninstead of rawStrings. - API: new
offset,lastSyncAt,lastSyncServer, andclearCache()getters / utility. - API:
isSupportedgetter (returnsfalseon the web). - DNS lookup now honors the supplied
timeout. - Bumped lints to
flutter_lints ^5.0.0, SDK constraints to Dart 3.4 / Flutter 3.22. - Rebuilt the example with Material 3 and a live "ticking" NTP clock.
- Fix: the cache was effectively never hit. The previous code stored the
NTP offset as the cached value and later interpreted it as a
-
0.0.227 Jun 2024 -
0.0.127 Jun 2024