Feature SDKs (Pro)
connectivity_sdk Pro
- Tier
- Proversion 1.2.6
- Command
archipelago generate connectivity_sdk- Generates
features/connectivity/connectivity_apifeatures/connectivity/connectivity_impl
- Depends on
- shared_identifiersgenerate these first
Passive connectivity monitoring SDK wrapping
connectivity_plusandnetwork_info_plus. Exposes a stream-based connectivity state, an online/offline boolean stream, force-refresh, and Wi-Fi SSID lookup — no UI, no routes.
Variables
This brick has no generation-time variables (brick.yaml declares no vars:).
Usage
Interactive
archipelago generate connectivity_sdkNon-interactive (CI)
archipelago generate connectivity_sdk --config my_config.jsonGenerated Structure
features/
└── connectivity/
├── connectivity_api/
│ └── lib/src/
│ ├── connectivity_sdk.dart # ConnectivitySDK interface
│ └── models/
│ ├── connectivity_state.dart # ConnectivityState (class, not enum)
│ └── connectivity_type.dart # ConnectivityType enum
└── connectivity_impl/
└── lib/src/
├── connectivity_sdk_impl.dart # ConnectivitySDKImpl
└── di/API
abstract interface class ConnectivitySDK implements FeatureSDK {
Stream<ConnectivityState> get stateStream; // replays current state on subscribe
Stream<bool> get onlineStream; // distinct-mapped from stateStream
ConnectivityState get currentState;
bool get isOnline;
Future<ConnectivityState> refresh();
Future<String?> getWifiSsid();
}
class ConnectivityState extends Equatable {
const ConnectivityState({required this.types, required this.isOnline, this.wifiSsid});
const ConnectivityState.offline(); // types: [ConnectivityType.none], isOnline: false
final List<ConnectivityType> types;
final bool isOnline;
final String? wifiSsid;
}
enum ConnectivityType { wifi, mobile, ethernet, vpn, bluetooth, satellite, other, none }ConnectivityState is a class, not an enum — types is a List<ConnectivityType> (a device can report more than one active interface), and isOnline/wifiSsid are fields on the state snapshot. ConnectivityType is the enum covering wifi, mobile, ethernet, vpn, bluetooth, satellite (iOS NWPath.isUltraConstrained / Android 15+ TRANSPORT_SATELLITE), other, and none.
final connectivity = getIt<ConnectivitySDK>();
connectivity.stateStream.listen((state) {
if (!state.isOnline) showOfflineBanner();
});
if (!connectivity.isOnline) throw const NoConnectivityException();
final state = await connectivity.refresh();ConnectivitySDKImpl (@Singleton, eager since 1.1.1) self-registers with FeatureSDKRegistry.instance.register(this) in its constructor and implements the full FeatureSDK contract (registerRoutes is a no-op — passive SDK, no screens), subscribing to Connectivity.onConnectivityChanged immediately on construction.
Wi-Fi SSID
getWifiSsid() calls NetworkInfo.getWifiName() and returns null on any Exception (not on Wi-Fi, missing permission, or unsupported platform).
Android Permission
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />Request at runtime before calling getWifiSsid() — the SDK does not request permissions itself.
iOS Entitlement
<key>com.apple.developer.networking.wifi-info</key>
<true/>Enable the Access Wi-Fi Information capability in Xcode and your provisioning profile.
Dependency injection
# connectivity_impl/pubspec.yaml
archipelago:
di_modules:
- class: ConnectivityImplPackageModulepost_gen.dart adds both packages to the workspace, adds connectivity_impl to the app's pubspec.yaml, wires ConnectivityImplPackageModule into the app's injector.dart, runs dart format, and records the brick in archipelago.yaml.
ConnectivityRegisterModule provides the raw Connectivity/NetworkInfo plugin instances as lazy singletons.
Dependencies
feature_sdk,router_registry,identifiers(shared workspace packages —FeatureSDKcontract + registry)connectivity_plus: ^7.3.1network_info_plus: ^8.2.1
Known Limitations
ConnectivityState.wifiSsidis populated onstateStream/currentState/refresh()only when the active interface is Wi-Fi and the platform allows the lookup (Android location permission, iOS Wi-Fi Information entitlement); otherwise it isnull. The lookup is guarded so a slow SSID read cannot overwrite a newer connectivity change (since 1.2.0).- No web/desktop SSID support (
network_info_pluslimitation, not this brick's).
Changelog
Run archipelago brick info connectivity_sdk to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.