Skip to content

Commit 69026c5

Browse files
committed
docs(connectivity_plus): update doc comment of Connectivity to reflect ConnectivityResultListX in connectivity_plus_platform_interface
1 parent ddef2fe commit 69026c5

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

packages/connectivity_plus/connectivity_plus/lib/connectivity_plus.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,20 @@ class Connectivity {
4141
/// status changes, this is a known issue that only affects simulators.
4242
/// For details see https://github.com/fluttercommunity/plus_plugins/issues/479.
4343
///
44-
/// The emitted list is never empty. In case of no connectivity, the list contains
44+
/// The emitted list is never empty.
45+
/// {@template no_connectivity_case}
46+
/// In case of no connectivity, the list contains
4547
/// a single element of [ConnectivityResult.none]. Note also that this is the only
4648
/// case where [ConnectivityResult.none] is present.
4749
///
50+
/// Use `hasConnectivity` to determine whether any active network connection exists:
51+
///
52+
/// ```dart
53+
/// final result = await checkConnectivity();
54+
/// print(result.hasConnectivity);
55+
/// ```
56+
/// {@endtemplate}
57+
///
4858
/// This method applies [Stream.distinct] over the received events to ensure
4959
/// only emitting when connectivity changes.
5060
Stream<List<ConnectivityResult>> get onConnectivityChanged {
@@ -57,9 +67,8 @@ class Connectivity {
5767
/// make a network request, it only gives you the radio status. Instead, listen
5868
/// for connectivity changes via [onConnectivityChanged] stream.
5969
///
60-
/// The returned list is never empty. In case of no connectivity, the list contains
61-
/// a single element of [ConnectivityResult.none]. Note also that this is the only
62-
/// case where [ConnectivityResult.none] is present.
70+
/// The returned list is never empty.
71+
/// {@macro no_connectivity_case}
6372
Future<List<ConnectivityResult>> checkConnectivity() {
6473
return _platform.checkConnectivity();
6574
}

0 commit comments

Comments
 (0)