Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 7c76492

Browse files
committed
[connectivity_platform_interface] Add ConnectivityResult.unknown.
Some platforms might not be able to determine the connectivity status of the device on which the app is running (like some desktop Web browsers). This allows users of the `connectivity` plugin to distinguish between "no connectivity" and "connectivity couldn't be determined". This requires a Major Version bump for users of the plugin who may be switch/case on ConnectivityResult values, since Dart forces users to be exhaustive in those cases (if they don't have a "default" entry, this new value becomes a compilation error in their code). This will also cause a Major Version bump in the core `connectivity` plugin itself.
1 parent 458b524 commit 7c76492

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/connectivity/connectivity_platform_interface/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.0.0
2+
3+
* Added `ConnectivityResult.unknown`, for the cases where the plugin is unable to determine the
4+
connectivity status of the device. _(This happens mostly in the `web` platform.)_
5+
16
## 1.0.3
27

38
* Make the pedantic dev_dependency explicit.

packages/connectivity/connectivity_platform_interface/lib/src/enums.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ enum ConnectivityResult {
77
mobile,
88

99
/// None: Device not connected to any network
10-
none
10+
none,
11+
12+
/// Unknown: The plugin wasn't able to determine the connectivity status of the device
13+
unknown,
1114
}
1215

1316
/// The status of the location service authorization.

packages/connectivity/connectivity_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the connectivity plugin.
33
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 1.0.3
6+
version: 2.0.0
77

88
dependencies:
99
flutter:

0 commit comments

Comments
 (0)