FlutterTimeGuard class

Provides functionality to listen for system time changes and validate the current time.

Use FlutterTimeGuard to detect manual changes to the system time and ensure its accuracy by comparing it against the network time.

Constructors

FlutterTimeGuard()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

realTime DateTime?
The reference time used to validate the current system time.
getter/setter pair

Static Methods

configureLogging({bool enableLogs = false}) → void
Enables or disables FlutterTimeGuard logging.
isDateTimeValid({int toleranceInSeconds = 86400}) Future<bool>
Validates the current system time by comparing it with the network time (NTP).
listenToDateTimeChange({required dynamic onTimeChanged(), required bool stopListeingAfterFirstChange}) → void
Listens for manual changes to the system time made by the user, while ignoring automatic time updates (e.g., synchronization with network time).
log(Object? message, {Object? error}) → void
Logs a diagnostic message when logging is enabled via configureLogging.
reset() Future<void>
Reset the time guard state on both Flutter and native sides.