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

Merge null-safety plugins #3324

Merged
merged 63 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
e5e0c3b
[plugin_platform_interface] Migrate to null safety (#3115)
Oct 9, 2020
3971a20
Configure analyzer for plugins that are migrated to nnbd (#3150)
Oct 14, 2020
6018398
Merge remote-tracking branch 'upstream/master' into nnbd
Oct 15, 2020
ab36fed
[url_launcher] Url launcher platform interface null safety (#3142)
mvanbeusekom Oct 15, 2020
b1fb69e
EOF missing in analysis_options.yaml
Oct 15, 2020
ce3b264
[video_player_platform_interface] Migrate to null safety (#3159)
Oct 16, 2020
f98493d
[device_info_platform_interface][device_info] nnbd (#3144)
Oct 16, 2020
5b049f4
[device_info][device_info_platform_interface] update to git deps (#3164)
Oct 18, 2020
7dd61d9
[video_player] Migrate video player to null safety (#3165)
Oct 20, 2020
052ec5f
[url_launcher] migrate url_launcher package to null safety (#3148)
mvanbeusekom Oct 21, 2020
7bc1151
[nnbd] Various fixes (#3175)
Oct 21, 2020
318729c
Merge branch 'master' into nnbd_update
Oct 23, 2020
a26f14f
[url_launcher] Migrates Link to null safety (#3196)
Oct 23, 2020
b597e4b
[connectivity][connectvity_platform_interface] migrate to nnbd (#3176)
Oct 23, 2020
a985f12
[connectivity][connectivity_platform_interface] update to git deps (#…
Oct 23, 2020
f32e26e
[device_info_platform_interface] update to major version bump for nnb…
Oct 23, 2020
ca92553
Various fixes
Oct 24, 2020
ae2a6c5
Fix video_player test
Oct 24, 2020
9b8a971
[plugin_platform_interface] Allow to publish
Oct 28, 2020
aad2e72
Change plugin_platform_interface git to pub version
Oct 28, 2020
1ca3198
[connectivity_platform_interface] Allow to publish
Oct 28, 2020
c025add
[connectivity] Allow to publish
Oct 28, 2020
4dccf1f
[device_info_platform_interface] Allow to publish
Oct 28, 2020
0b15324
[device_info] Allow to publish
Oct 28, 2020
e5bef4c
[video_player_platform_interface] Allow to publish
Oct 28, 2020
59e125e
[url_launcher_macos] Fix pubspec version
Oct 28, 2020
c98182b
[video_player] Fix version in pubspec
Oct 28, 2020
5b0309c
[device_info][video_player] Fix versions
Oct 28, 2020
512b393
[video_player] Fix changelog
Oct 28, 2020
e40bd96
[url_launcher] Update dependencies
Oct 28, 2020
f3dd76f
[url_launcher] Fix dependencies
Oct 28, 2020
31664cf
[device_info] Fix pubspec version
Oct 28, 2020
72949fe
[video_player_web] Fix version
Oct 28, 2020
57efa1d
[video_player_web] Allow to publish
Oct 28, 2020
8b8edd0
[video_player] Fix pubspec
Oct 28, 2020
bb4c359
Merge branch 'master' into update_nnbd
Nov 2, 2020
b69ac40
Bump SDK version
Nov 4, 2020
0f6a1be
[device_info] Bump SDK
Nov 5, 2020
f9529b2
[Path Provider] Migrate platform interface to nnbd (#3249)
mehmetf Nov 6, 2020
3a273d8
[local_auth] Migrate to null safety. (#3255)
mehmetf Nov 7, 2020
e62de47
[device_info_platform_interface] Remove default types and correct nul…
Nov 18, 2020
a9e538a
[video_player] Dart requires null safety 2.12
Dec 2, 2020
7764b75
[video_player] Fix CHANGELOG/pubspec
Dec 2, 2020
254f4c6
[video_player] Fix mistake
Dec 2, 2020
9a92712
[video_player] remove null!
Dec 2, 2020
399e220
Merge branch 'master' into update_nnbd
Dec 11, 2020
b8b6a6e
Remove enable-experiment
Dec 11, 2020
76b9d4c
Add skip list
Dec 11, 2020
869b81f
Fix custom analysis
Dec 11, 2020
f8437d3
clean up
Dec 11, 2020
00deb11
Disable version check momentarily
Dec 11, 2020
6d9f34a
Version range
Dec 12, 2020
11e295f
Merge branch 'master' into update_nnbd
Dec 12, 2020
ffa3844
Fix pubspecs
Dec 12, 2020
5908224
[video_player_platform_interface] messages.dart use 2.12
Dec 12, 2020
666c4d5
Bump video_player_platform_interface
Dec 12, 2020
0620954
pubspec fixes
Dec 12, 2020
d05616e
[flutter_plugin_android_lifecycle] null safety
Dec 12, 2020
748bcb3
[local_auth] Fix pub dependencies
Dec 12, 2020
580656d
[connectivity_macos] null safety
Dec 12, 2020
34667d4
[connectivity] connectivity_macos null safety
Dec 12, 2020
2ae46c8
Update nnbd plugins
Dec 12, 2020
22cde38
[flutter_plugin_android_lifecycle] Example SDK app
Dec 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/connectivity/connectivity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 3.0.0-nullsafety.1

* Bump Dart SDK to support null safety.

## 3.0.0-nullsafety

* Migrate to null safety.

## 2.0.3

* Update Flutter SDK constraint.
Expand Down
4 changes: 4 additions & 0 deletions packages/connectivity/connectivity/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: ../../../analysis_options.yaml
analyzer:
enable-experiment:
- non-nullable
6 changes: 3 additions & 3 deletions packages/connectivity/connectivity/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MyApp extends StatelessWidget {
}

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

final String title;

Expand All @@ -51,7 +51,7 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
String _connectionStatus = 'Unknown';
final Connectivity _connectivity = Connectivity();
StreamSubscription<ConnectivityResult> _connectivitySubscription;
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;
ConnectivityResult result = ConnectivityResult.none;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
result = await _connectivity.checkConnectivity();
Expand Down
3 changes: 2 additions & 1 deletion packages/connectivity/connectivity/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ dependencies:
dev_dependencies:
flutter_driver:
sdk: flutter
test: ^1.10.0-nullsafety.1
integration_test:
path: ../../../integration_test
pedantic: ^1.8.0
pedantic: ^1.10.0-nullsafety.1

flutter:
uses-material-design: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(cyanglaz): Remove once https://github.com/flutter/plugins/pull/3158 is landed.
// @dart = 2.9

import 'package:integration_test/integration_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:connectivity/connectivity.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(cyanglaz): Remove once https://github.com/flutter/plugins/pull/3158 is landed.
// @dart = 2.9

import 'package:integration_test/integration_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:connectivity/connectivity.dart';
Expand Down
4 changes: 2 additions & 2 deletions packages/connectivity/connectivity/lib/connectivity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class Connectivity {
if (_singleton == null) {
_singleton = Connectivity._();
}
return _singleton;
return _singleton!;
}

Connectivity._();

static Connectivity _singleton;
static Connectivity? _singleton;

static ConnectivityPlatform get _platform => ConnectivityPlatform.instance;

Expand Down
15 changes: 9 additions & 6 deletions packages/connectivity/connectivity/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: connectivity
description: Flutter plugin for discovering the state of the network (WiFi &
mobile/cellular) connectivity on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity
version: 2.0.3
version: 3.0.0-nullsafety.1

flutter:
plugin:
Expand All @@ -21,21 +21,24 @@ dependencies:
flutter:
sdk: flutter
meta: ^1.0.5
connectivity_platform_interface: ^1.0.2
connectivity_platform_interface: 2.0.0-nullsafety.1
#TODO(cyanglaz): re-endorse the below plugins when they have migrated to nnbd.
# https://github.com/flutter/flutter/issues/68669
connectivity_macos: ^0.1.0
connectivity_for_web: ^0.3.0
# connectivity_for_web: ^0.3.0

dev_dependencies:
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
test: ^1.10.0-nullsafety.1
integration_test:
path: ../../integration_test
mockito: ^4.1.1
plugin_platform_interface: ^1.0.0
pedantic: ^1.8.0
plugin_platform_interface: ^1.1.0-nullsafety.1
pedantic: ^1.10.0-nullsafety.1

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

// @dart = 2.8

// TODO(cyanglaz): Remove once Mockito is migrated to null safety.
// @dart = 2.9
import 'package:connectivity/connectivity.dart';
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.0.0-nullsafety.1

* Bump Dart SDK to support null safety.

## 2.0.0-nullsafety

* Migrate to null safety.

## 1.0.7

* Update Flutter SDK constraint.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: ../../../analysis_options.yaml
analyzer:
enable-experiment:
- non-nullable
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ abstract class ConnectivityPlatform extends PlatformInterface {
}

/// Obtains the wifi name (SSID) of the connected network
Future<String> getWifiName() {
Future<String?> getWifiName() {
throw UnimplementedError('getWifiName() has not been implemented.');
}

/// Obtains the wifi BSSID of the connected network.
Future<String> getWifiBSSID() {
Future<String?> getWifiBSSID() {
throw UnimplementedError('getWifiBSSID() has not been implemented.');
}

/// Obtains the IP address of the connected wifi network
Future<String> getWifiIP() {
Future<String?> getWifiIP() {
throw UnimplementedError('getWifiIP() has not been implemented.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ class MethodChannelConnectivity extends ConnectivityPlatform {
EventChannel eventChannel =
EventChannel('plugins.flutter.io/connectivity_status');

Stream<ConnectivityResult> _onConnectivityChanged;
Stream<ConnectivityResult>? _onConnectivityChanged;

/// Fires whenever the connectivity state changes.
Stream<ConnectivityResult> get onConnectivityChanged {
if (_onConnectivityChanged == null) {
_onConnectivityChanged = eventChannel
.receiveBroadcastStream()
.map((dynamic result) => result.toString())
.map(parseConnectivityResult);
_onConnectivityChanged =
eventChannel.receiveBroadcastStream().map((dynamic result) {
return result != null ? result.toString() : '';
}).map(parseConnectivityResult);
}
return _onConnectivityChanged;
return _onConnectivityChanged!;
}

@override
Future<ConnectivityResult> checkConnectivity() {
return methodChannel
.invokeMethod<String>('check')
.then(parseConnectivityResult);
Future<ConnectivityResult> checkConnectivity() async {
final String checkResult =
await methodChannel.invokeMethod<String>('check') ?? '';
return parseConnectivityResult(checkResult);
}

@override
Future<String> getWifiName() async {
String wifiName = await methodChannel.invokeMethod<String>('wifiName');
Future<String?> getWifiName() async {
String? wifiName = await methodChannel.invokeMethod<String>('wifiName');
// as Android might return <unknown ssid>, uniforming result
// our iOS implementation will return null
if (wifiName == '<unknown ssid>') {
Expand All @@ -54,29 +54,31 @@ class MethodChannelConnectivity extends ConnectivityPlatform {
}

@override
Future<String> getWifiBSSID() {
Future<String?> getWifiBSSID() {
return methodChannel.invokeMethod<String>('wifiBSSID');
}

@override
Future<String> getWifiIP() {
Future<String?> getWifiIP() {
return methodChannel.invokeMethod<String>('wifiIPAddress');
}

@override
Future<LocationAuthorizationStatus> requestLocationServiceAuthorization({
bool requestAlwaysLocationUsage = false,
}) {
return methodChannel.invokeMethod<String>(
'requestLocationServiceAuthorization', <bool>[
requestAlwaysLocationUsage
]).then(parseLocationAuthorizationStatus);
}) async {
final String requestLocationServiceResult = await methodChannel
.invokeMethod<String>('requestLocationServiceAuthorization',
<bool>[requestAlwaysLocationUsage]) ??
'';
return parseLocationAuthorizationStatus(requestLocationServiceResult);
}

@override
Future<LocationAuthorizationStatus> getLocationServiceAuthorization() {
return methodChannel
.invokeMethod<String>('getLocationServiceAuthorization')
.then(parseLocationAuthorizationStatus);
Future<LocationAuthorizationStatus> getLocationServiceAuthorization() async {
final String getLocationServiceResult = await methodChannel
.invokeMethod<String>('getLocationServiceAuthorization') ??
'';
return parseLocationAuthorizationStatus(getLocationServiceResult);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ description: A common platform interface for the connectivity plugin.
homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 1.0.7
version: 2.0.0-nullsafety.1

dependencies:
flutter:
sdk: flutter
meta: ^1.0.5
plugin_platform_interface: ^1.0.1
meta: ^1.3.0-nullsafety.3
plugin_platform_interface: ^1.1.0-nullsafety.1

dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.8.0
pedantic: ^1.10.0-nullsafety.1

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.12.13+hotfix.5"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void main() {

group('$MethodChannelConnectivity', () {
final List<MethodCall> log = <MethodCall>[];
MethodChannelConnectivity methodChannelConnectivity;
late MethodChannelConnectivity methodChannelConnectivity;

setUp(() async {
methodChannelConnectivity = MethodChannelConnectivity();
Expand Down Expand Up @@ -42,7 +42,7 @@ void main() {
.setMockMethodCallHandler((MethodCall methodCall) async {
switch (methodCall.method) {
case 'listen':
await ServicesBinding.instance.defaultBinaryMessenger
await ServicesBinding.instance!.defaultBinaryMessenger
.handlePlatformMessage(
methodChannelConnectivity.eventChannel.name,
methodChannelConnectivity.eventChannel.codec
Expand All @@ -64,7 +64,7 @@ void main() {
});

test('getWifiName', () async {
final String result = await methodChannelConnectivity.getWifiName();
final String? result = await methodChannelConnectivity.getWifiName();
expect(result, '1337wifi');
expect(
log,
Expand All @@ -78,7 +78,7 @@ void main() {
});

test('getWifiBSSID', () async {
final String result = await methodChannelConnectivity.getWifiBSSID();
final String? result = await methodChannelConnectivity.getWifiBSSID();
expect(result, 'c0:ff:33:c0:d3:55');
expect(
log,
Expand All @@ -92,7 +92,7 @@ void main() {
});

test('getWifiIP', () async {
final String result = await methodChannelConnectivity.getWifiIP();
final String? result = await methodChannelConnectivity.getWifiIP();
expect(result, '127.0.0.1');
expect(
log,
Expand Down
8 changes: 8 additions & 0 deletions packages/device_info/device_info/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.0.0-nullsafety.1

* Bump Dart SDK to support null safety.

## 2.0.0-nullsafety

* Migrate to null safety.

## 1.0.1

* Update Flutter SDK constraint.
Expand Down
4 changes: 4 additions & 0 deletions packages/device_info/device_info/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: ../../../analysis_options.yaml
analyzer:
enable-experiment:
- non-nullable
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// TODO(cyanglaz): Remove once https://github.com/flutter/plugins/pull/3158 is landed.
// @dart = 2.9

import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:device_info/device_info.dart';
Expand Down
2 changes: 1 addition & 1 deletion packages/device_info/device_info/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class _MyAppState extends State<MyApp> {
}

Future<void> initPlatformState() async {
Map<String, dynamic> deviceData;
Map<String, dynamic> deviceData = <String, dynamic>{};

try {
if (Platform.isAndroid) {
Expand Down
4 changes: 2 additions & 2 deletions packages/device_info/device_info/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ dev_dependencies:
sdk: flutter
integration_test:
path: ../../../integration_test
pedantic: ^1.8.0
pedantic: ^1.10.0-nullsafety.1

flutter:
uses-material-design: true

environment:
sdk: ">=2.1.0<3.0.0"
sdk: ">=2.10.0-56.0.dev <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// TODO(cyanglaz): Remove once https://github.com/flutter/flutter/issues/59879 is fixed.
// @dart = 2.9

import 'dart:async';
import 'dart:convert';
import 'dart:io';
Expand Down