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

[connectivity][connectvity_platform_interface] migrate to nnbd #3176

Merged
merged 13 commits into from
Oct 23, 2020

Conversation

cyanglaz
Copy link
Contributor

Since connectivity_web has not migrated, temporarily un-endorse the web plugin.

All the deps are path deps for now, will submit another PR to update them to git dep after landing this.

@cyanglaz cyanglaz requested a review from blasten October 21, 2020 02:26
@@ -23,12 +23,12 @@ class Connectivity {
if (_singleton == null) {
_singleton = Connectivity._();
}
return _singleton;
return _singleton!;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. In some cases the analyzer is smart enough to figure out that _singleton cannot be null at this point, so ! isn't required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got an error trying to remove !

./lib/connectivity.dart:25:12: Error: A value of type 'Connectivity?' can't be returned from a function with return type 'Connectivity'.
 - 'Connectivity' is from 'package:connectivity/connectivity.dart' ('../lib/connectivity.dart').
    return _singleton;```

@@ -1,3 +1,7 @@
## 1.1.0-nullsafety
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be 2.0.0-nullsafety ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that other platform_interfaces are only bumping minor version. Are we going to break platform_interface as well?

@@ -14,7 +14,7 @@ ConnectivityResult parseConnectivityResult(String state) {
}

/// Convert a String to a LocationAuthorizationStatus value.
LocationAuthorizationStatus parseLocationAuthorizationStatus(String result) {
LocationAuthorizationStatus parseLocationAuthorizationStatus(String? result) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like result could be non-null, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1,7 +1,7 @@
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';

/// Convert a String to a ConnectivityResult value.
ConnectivityResult parseConnectivityResult(String state) {
ConnectivityResult parseConnectivityResult(String? state) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like state could be non-null, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % minor comments

Copy link
Contributor Author

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

@@ -1,3 +1,7 @@
## 1.1.0-nullsafety
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that other platform_interfaces are only bumping minor version. Are we going to break platform_interface as well?

@@ -1,7 +1,7 @@
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';

/// Convert a String to a ConnectivityResult value.
ConnectivityResult parseConnectivityResult(String state) {
ConnectivityResult parseConnectivityResult(String? state) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -14,7 +14,7 @@ ConnectivityResult parseConnectivityResult(String state) {
}

/// Convert a String to a LocationAuthorizationStatus value.
LocationAuthorizationStatus parseLocationAuthorizationStatus(String result) {
LocationAuthorizationStatus parseLocationAuthorizationStatus(String? result) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -23,12 +23,12 @@ class Connectivity {
if (_singleton == null) {
_singleton = Connectivity._();
}
return _singleton;
return _singleton!;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got an error trying to remove !

./lib/connectivity.dart:25:12: Error: A value of type 'Connectivity?' can't be returned from a function with return type 'Connectivity'.
 - 'Connectivity' is from 'package:connectivity/connectivity.dart' ('../lib/connectivity.dart').
    return _singleton;```

@cyanglaz cyanglaz merged commit b597e4b into flutter:nnbd Oct 23, 2020
@cyanglaz cyanglaz deleted the nnbd_connectivity branch October 23, 2020 21:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants