ConnectivityConfig class
Configuration passed to SmartConnectivityMonitor.initialize.
All fields have sensible production-ready defaults. Only override what you need.
await SmartConnectivityMonitor.initialize(
config: ConnectivityConfig(
probeInterval: Duration(seconds: 20),
enableCaching: true,
),
);
Constructors
- ConnectivityConfig({Duration probeInterval = const Duration(seconds: 30), Duration probeTimeout = const Duration(seconds: 6), int excellentLatencyMs = 100, int goodLatencyMs = 200, int moderateLatencyMs = 600, int instabilityDropThreshold = 3, Duration instabilityWindow = const Duration(minutes: 2), bool enableCaching = true, String probeUrl = 'https://connectivitycheck.gstatic.com/generate_204', String fallbackProbeUrl = 'https://www.apple.com/library/test/success.html'})
-
const
Properties
- enableCaching → bool
-
Whether to persist last known state in SharedPreferences. Default: true.
final
- excellentLatencyMs → int
-
Latency below which quality is ConnectionQuality.excellent. Default: 100ms.
final
- fallbackProbeUrl → String
-
Fallback probe URL if primary is unreachable. Defaults to Apple success.
final
- goodLatencyMs → int
-
Latency below which quality is ConnectionQuality.good. Default: 200ms.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- instabilityDropThreshold → int
-
Number of drops within instabilityWindow to flag as unstable. Default: 3.
final
- instabilityWindow → Duration
-
Rolling window for instability detection. Default: 2 minutes.
final
- moderateLatencyMs → int
-
Latency below which quality is ConnectionQuality.moderate. Default: 600ms.
final
- probeInterval → Duration
-
How often to run a background probe when the interface hasn't changed.
Lower = more responsive but more battery. Default: 30 seconds.
final
- probeTimeout → Duration
-
Hard timeout per probe attempt. Default: 6 seconds.
final
- probeUrl → String
-
Primary probe URL. Defaults to Google's generate_204 endpoint.
final
- 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
Constants
- relaxed → const ConnectivityConfig
- Relaxed config for low-power or content apps.
- strict → const ConnectivityConfig
- Strict config for fintech / high-reliability apps. More frequent probes, tighter quality thresholds.