onConnectivityChanged property
Stream<NetworkConnectionInfo>
get
onConnectivityChanged
监听网络连接变化 / Emits a fresh snapshot whenever connectivity changes.
立即发出一次当前状态,随后在每次底层变化时重新采集 / Emits the current state immediately, then re-samples on every change.
Implementation
Stream<NetworkConnectionInfo> get onConnectivityChanged async* {
yield await checkConnection();
await for (final _ in _adapter.onConnectivityChanged) {
yield await checkConnection();
}
}