Skip to content

Commit

Permalink
[connectivity_macos] move NNBD to stable (flutter#3588)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Yang authored Feb 22, 2021
1 parent 9d00dd2 commit e8c8cf6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
11 changes: 2 additions & 9 deletions packages/connectivity/connectivity_macos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
## 2.0.0-nullsafety

* Update version to (semi-belatedly) meet 1.0-consistency promise.

## 0.2.0-nullsafety.1
## 2.0.0

* Remove placeholder Dart file.

## 0.2.0-nullsafety

* Update Dart SDK constraint.
* Update Dart SDK constraint for compatibility with null safety.

## 0.1.0+8

Expand Down
14 changes: 7 additions & 7 deletions packages/connectivity/connectivity_macos/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import 'dart:async';
import 'dart:io';

import 'package:connectivity/connectivity.dart';
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -40,18 +40,18 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
MyHomePage({Key? key, this.title}) : super(key: key);

final String title;
final String? title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
String _connectionStatus = 'Unknown';
final Connectivity _connectivity = Connectivity();
StreamSubscription<ConnectivityResult> _connectivitySubscription;
final ConnectivityPlatform _connectivity = ConnectivityPlatform.instance;
late StreamSubscription<ConnectivityResult> _connectivitySubscription;

@override
void initState() {
Expand All @@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {

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

try {
if (Platform.isIOS) {
Expand Down
6 changes: 3 additions & 3 deletions packages/connectivity/connectivity_macos/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Demonstrates how to use the connectivity plugin.
dependencies:
flutter:
sdk: flutter
connectivity: any
connectivity_platform_interface: ^2.0.0
connectivity_macos:
# When depending on this package from a real application you should use:
# connectivity_macos: ^x.y.z
Expand All @@ -18,11 +18,11 @@ dev_dependencies:
sdk: flutter
integration_test:
path: ../../../integration_test
pedantic: ^1.8.0
pedantic: ^1.10.0

flutter:
uses-material-design: true

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.12.0-259.9.beta <3.0.0"
flutter: ">=1.10.0"
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9
import 'dart:io';
import 'package:integration_test/integration_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:connectivity/connectivity.dart';
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

group('Connectivity test driver', () {
Connectivity _connectivity;
ConnectivityPlatform _connectivity;

setUpAll(() async {
_connectivity = Connectivity();
_connectivity = ConnectivityPlatform.instance;
});

testWidgets('test connectivity result', (WidgetTester tester) async {
Expand Down
6 changes: 3 additions & 3 deletions packages/connectivity/connectivity_macos/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: connectivity_macos
description: macOS implementation of the connectivity plugin.
version: 2.0.0-nullsafety
version: 2.0.0
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos

flutter:
Expand All @@ -10,12 +10,12 @@ flutter:
pluginClass: ConnectivityPlugin

environment:
sdk: ">=2.12.0-0 <3.0.0"
sdk: ">=2.12.0-259.9.beta <3.0.0"
flutter: ">=1.10.0"

dependencies:
flutter:
sdk: flutter

dev_dependencies:
pedantic: ^1.8.0
pedantic: ^1.10.0

0 comments on commit e8c8cf6

Please sign in to comment.