network_reachability library

Network Reachability

A high-performance, comprehensive networking library for Dart and Flutter, powered by a multi-threaded Rust engine.

This library goes beyond simple "is it connected?" checks by providing:

  • Deep Quality Analysis: Detailed latency, jitter, and packet loss metrics.
  • Security Probes: Detection of VPNs, DNS hijacking, and proxies.
  • Resilience Patterns: Built-in circuit breakers and adaptive polling.
  • Multi-platform: Consistent behavior across Android, iOS, Web, and Desktop.

Architecture

The library follows Clean Architecture principles:

For getting started, see NetworkReachability.init.

Classes

CaptivePortalStatus
The result of a captive portal detection probe.
LatencyStats
A suite of statistical metrics derived from multiple latency samples.
NetworkConfiguration
The master configuration for the Network Reachability Engine.
NetworkReachability
The central entry point for the Network Reachability library.
NetworkReport
NetworkReportImpl
NetworkStatus
A high-level summary of the network's current state.
NetworkTarget
Configuration for a specific network endpoint to be monitored.
QualityThresholds
Defines the latency thresholds (in milliseconds) used to categorize `ConnectionQuality`.
ResilienceConfig
Configuration for network resilience, failure handling, and statistical analysis.
RustLib
Main entrypoint of the Rust API
RustLibApi
RustLibApiImpl
SecurityConfig
Configuration for security-related network checks and policy enforcement.
SecurityFlags
Internal representation of security-related attributes for the current connection.
SecurityFlagsResult
SecurityFlagsResultImpl
TargetReport
Detailed outcome of a connectivity check against a specific target.

Enums

CheckStrategy
Defines the strategy used when evaluating multiple network targets during a check cycle.
CircuitBreakerState
Represents the operational state of the Circuit Breaker pattern.
ConnectionQuality
Represents the perceived quality of the network connection based on latency, jitter, and stability.
ConnectionType
Represents the physical or logical medium of the active network connection.
SecurityAlert
Identifies specific security violations or network policy alerts.
TargetProtocol
Supported network protocols for performing reachability probes.

Extensions

CaptivePortalStatusCopyWith on CaptivePortalStatus
Extension on CaptivePortalStatus for status immutability.
LatencyStatsCopyWith on LatencyStats
Extension on LatencyStats for granular metric management.
NetworkConfigurationCopyWith on NetworkConfiguration
Extension on NetworkConfiguration to enable easy immutability.
NetworkReportCopyWith on NetworkReport
Extension on NetworkReport (Opaque pointer) to allow mutation.
NetworkStatusCopyWith on NetworkStatus
Extension on NetworkStatus for summary updates.
NetworkTargetCopyWith on NetworkTarget
Extension on NetworkTarget to modify probe endpoint definitions.
QualityThresholdsCopyWith on QualityThresholds
Extension on QualityThresholds for easy updates to latency categorization.
ResilienceConfigCopyWith on ResilienceConfig
Extension on ResilienceConfig to tune circuit breaker and stability scoring.
SecurityConfigCopyWith on SecurityConfig
Extension on SecurityConfig for toggling network security probes.
SecurityFlagsCopyWith on SecurityFlags
Extension on SecurityFlags for interface security metadata.
SecurityFlagsResultCopyWith on SecurityFlagsResult
Extension on SecurityFlagsResult (Opaque pointer) to allow mutation.
TargetReportCopyWith on TargetReport
Extension on TargetReport for single target metrics.

Exceptions / Errors

CircuitBreakerOpenException
Exception thrown when the Circuit Breaker is active.
NetworkReachabilityException
Base class for all exceptions thrown by the Network Reachability library.
NetworkTimeoutException
Exception thrown when a network probe or check exceeds its allocated time.
PoorConnectionException
Exception thrown when the network quality is too low for a requested operation.
SecurityException
Exception thrown when a security policy is violated.