NetworkMetrics class

Tracks simple counters across calls made through NetworkGuard.

Entirely opt-in and in-memory — nothing is sent anywhere. Wire it into NetworkGuard.execute calls yourself (e.g. from a wrapper around your API layer) by calling recordRequest, recordCacheHit etc. at the relevant points.

Constructors

NetworkMetrics()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
snapshot → MetricsSnapshot
A snapshot of all counters as of now.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordCache({required bool hit}) → void
Records a cache read outcome.
recordQueued() → void
Records a task being added to the offline queue.
recordRequest({required bool success, int attempts = 1, bool timedOut = false, bool wasOffline = false, Duration? latency}) → void
Records the outcome of a single execute call.
reset() → void
Resets every counter back to zero.
toString() → String
A string representation of this object.
inherited

Operators

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