Skip to content

connectivity_sdk Pro

Passive connectivity monitoring SDK wrapping connectivity_plus and network_info_plus. Exposes stream-based connectivity state and Wi-Fi SSID via a clean API contract with no UI of its own.

Version: 1.0.0

Variables

This brick has no generation-time variables.

Usage

Interactive

bash
archipelago generate connectivity_sdk

Non-interactive (CI)

bash
archipelago generate connectivity_sdk --config my_config.json

Generated Structure

features/
└── connectivity/
    ├── connectivity_api/
    │   └── lib/src/
    │       └── models/
    └── connectivity_impl/
        └── lib/src/
            └── di/

DI Wiring

The post-gen hook automatically:

  1. Adds both packages to the workspace pubspec.yaml.
  2. Adds connectivity_impl to apps/template_app/pubspec.yaml.
  3. Injects ConnectivityImplPackageModule into apps/template_app/lib/di/injector.dart.
  4. Runs dart format on touched files.
  5. Records connectivity_sdk in archipelago.yaml.

Integration

dart
final connectivity = getIt<ConnectivitySDK>();

// Observe changes:
connectivity.stateStream.listen((state) {
  if (!state.isOnline) showOfflineBanner();
});

// Quick synchronous check:
if (!connectivity.isOnline) throw const NoConnectivityException();

// Force-refresh at app startup:
await connectivity.refresh();

Connectivity States

The ConnectivityState enum covers: wifi, mobile, ethernet, vpn, bluetooth, satellite, other, and none.

isOnline is true for all states except none.

Wi-Fi SSID

getWifiSsid() returns the current SSID or null when the device is not on Wi-Fi, the required permission is not granted, or the platform does not support it.

Android Permission

xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Request at runtime before calling getWifiSsid().

iOS Entitlement

Add the Wi-Fi information entitlement to your .entitlements file:

xml
<key>com.apple.developer.networking.wifi-info</key>
<true/>

Enable the Access Wi-Fi Information capability in Xcode and your provisioning profile.

Integration with feedback_sdk

Wire the connectivity state into feedback_sdk's offline queue:

dart
connectivitySDK.stateStream.listen((state) {
  feedbackSDK.recordConnectivity(online: state.isOnline);
});

Built by Banua Coder