-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[connectivity][connectvity_platform_interface] migrate to nnbd #3176
Conversation
@@ -23,12 +23,12 @@ class Connectivity { | |||
if (_singleton == null) { | |||
_singleton = Connectivity._(); | |||
} | |||
return _singleton; | |||
return _singleton!; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % minor comments
There was a problem hiding this 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 |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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!; |
There was a problem hiding this comment.
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;```
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.