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

Commit e8c8cf6

Browse files
author
Chris Yang
authored
[connectivity_macos] move NNBD to stable (#3588)
1 parent 9d00dd2 commit e8c8cf6

File tree

5 files changed

+19
-25
lines changed

5 files changed

+19
-25
lines changed

packages/connectivity/connectivity_macos/CHANGELOG.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
## 2.0.0-nullsafety
2-
3-
* Update version to (semi-belatedly) meet 1.0-consistency promise.
4-
5-
## 0.2.0-nullsafety.1
1+
## 2.0.0
62

73
* Remove placeholder Dart file.
8-
9-
## 0.2.0-nullsafety
10-
11-
* Update Dart SDK constraint.
4+
* Update Dart SDK constraint for compatibility with null safety.
125

136
## 0.1.0+8
147

packages/connectivity/connectivity_macos/example/lib/main.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import 'dart:async';
88
import 'dart:io';
99

10-
import 'package:connectivity/connectivity.dart';
10+
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';
1111
import 'package:flutter/foundation.dart';
1212
import 'package:flutter/material.dart';
1313
import 'package:flutter/services.dart';
@@ -40,18 +40,18 @@ class MyApp extends StatelessWidget {
4040
}
4141

4242
class MyHomePage extends StatefulWidget {
43-
MyHomePage({Key key, this.title}) : super(key: key);
43+
MyHomePage({Key? key, this.title}) : super(key: key);
4444

45-
final String title;
45+
final String? title;
4646

4747
@override
4848
_MyHomePageState createState() => _MyHomePageState();
4949
}
5050

5151
class _MyHomePageState extends State<MyHomePage> {
5252
String _connectionStatus = 'Unknown';
53-
final Connectivity _connectivity = Connectivity();
54-
StreamSubscription<ConnectivityResult> _connectivitySubscription;
53+
final ConnectivityPlatform _connectivity = ConnectivityPlatform.instance;
54+
late StreamSubscription<ConnectivityResult> _connectivitySubscription;
5555

5656
@override
5757
void initState() {
@@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {
6969

7070
// Platform messages are asynchronous, so we initialize in an async method.
7171
Future<void> initConnectivity() async {
72-
ConnectivityResult result;
72+
late ConnectivityResult result;
7373
// Platform messages may fail, so we use a try/catch PlatformException.
7474
try {
7575
result = await _connectivity.checkConnectivity();
@@ -100,7 +100,7 @@ class _MyHomePageState extends State<MyHomePage> {
100100
Future<void> _updateConnectionStatus(ConnectivityResult result) async {
101101
switch (result) {
102102
case ConnectivityResult.wifi:
103-
String wifiName, wifiBSSID, wifiIP;
103+
String? wifiName, wifiBSSID, wifiIP;
104104

105105
try {
106106
if (Platform.isIOS) {

packages/connectivity/connectivity_macos/example/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Demonstrates how to use the connectivity plugin.
44
dependencies:
55
flutter:
66
sdk: flutter
7-
connectivity: any
7+
connectivity_platform_interface: ^2.0.0
88
connectivity_macos:
99
# When depending on this package from a real application you should use:
1010
# connectivity_macos: ^x.y.z
@@ -18,11 +18,11 @@ dev_dependencies:
1818
sdk: flutter
1919
integration_test:
2020
path: ../../../integration_test
21-
pedantic: ^1.8.0
21+
pedantic: ^1.10.0
2222

2323
flutter:
2424
uses-material-design: true
2525

2626
environment:
27-
sdk: ">=2.1.0 <3.0.0"
27+
sdk: ">=2.12.0-259.9.beta <3.0.0"
2828
flutter: ">=1.10.0"

packages/connectivity/connectivity_macos/example/test_driver/integration_test/connectivity_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// @dart = 2.9
56
import 'dart:io';
67
import 'package:integration_test/integration_test.dart';
78
import 'package:flutter_test/flutter_test.dart';
8-
import 'package:connectivity/connectivity.dart';
9+
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';
910

1011
void main() {
1112
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
1213

1314
group('Connectivity test driver', () {
14-
Connectivity _connectivity;
15+
ConnectivityPlatform _connectivity;
1516

1617
setUpAll(() async {
17-
_connectivity = Connectivity();
18+
_connectivity = ConnectivityPlatform.instance;
1819
});
1920

2021
testWidgets('test connectivity result', (WidgetTester tester) async {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: connectivity_macos
22
description: macOS implementation of the connectivity plugin.
3-
version: 2.0.0-nullsafety
3+
version: 2.0.0
44
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos
55

66
flutter:
@@ -10,12 +10,12 @@ flutter:
1010
pluginClass: ConnectivityPlugin
1111

1212
environment:
13-
sdk: ">=2.12.0-0 <3.0.0"
13+
sdk: ">=2.12.0-259.9.beta <3.0.0"
1414
flutter: ">=1.10.0"
1515

1616
dependencies:
1717
flutter:
1818
sdk: flutter
1919

2020
dev_dependencies:
21-
pedantic: ^1.8.0
21+
pedantic: ^1.10.0

0 commit comments

Comments
 (0)