From e5e0c3beb9388a5d32834aecd07ec884bb7162a8 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 9 Oct 2020 12:00:56 -0700 Subject: [PATCH 01/58] [plugin_platform_interface] Migrate to null safety (#3115) --- .cirrus.yml | 10 +++++----- analysis_options.yaml | 2 ++ packages/plugin_platform_interface/CHANGELOG.md | 4 ++++ .../lib/plugin_platform_interface.dart | 2 +- packages/plugin_platform_interface/pubspec.yaml | 13 ++++++++----- .../test/plugin_platform_interface_test.dart | 2 ++ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 872cfc2316fa..756eb6e5dda2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -37,7 +37,7 @@ task: # https://github.com/flutter/flutter/issues/42864 - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - - ./script/incremental_build.sh test + - ./script/incremental_build.sh test --enable-experiment=non-nullable - name: analyze script: ./script/incremental_build.sh analyze - name: build_all_plugins_apk @@ -87,13 +87,13 @@ task: - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt - export CIRRUS_CHANGE_MESSAGE="" - export CIRRUS_COMMIT_MESSAGE="" - - ./script/incremental_build.sh build-examples --apk + - ./script/incremental_build.sh build-examples --apk --enable-experiment=non-nullable - ./script/incremental_build.sh java-test # must come after apk build - if [[ $GCLOUD_FIREBASE_TESTLAB_KEY == ENCRYPTED* ]]; then - echo "This user does not have permission to run Firebase Test Lab tests." - else - echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json - - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 + - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 --enable-experiment=non-nullable - fi - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` @@ -177,8 +177,8 @@ task: # https://github.com/flutter/flutter/issues/42864 - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - - ./script/incremental_build.sh build-examples --ipa - - ./script/incremental_build.sh drive-examples + - ./script/incremental_build.sh build-examples --ipa --enable-experiment=non-nullable + - ./script/incremental_build.sh drive-examples --enable-experiment=non-nullable task: # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins only_if: $CIRRUS_TAG == '' diff --git a/analysis_options.yaml b/analysis_options.yaml index b1261f36fac9..d771f8481ce5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,7 @@ include: package:pedantic/analysis_options.1.8.0.yaml analyzer: + enable-experiment: + - non-nullable exclude: # Ignore generated files - '**/*.g.dart' diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index 01b5ff7d1252..f8e848537c70 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.0-nullsafety + +* Migrate to null safety. + ## 1.0.3 * Fix homepage in `pubspec.yaml`. diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index be4871928686..cd87b04dc739 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -41,7 +41,7 @@ import 'package:meta/meta.dart'; /// [MockPlatformInterfaceMixin] for a sample of using Mockito to mock a platform interface. abstract class PlatformInterface { /// Pass a private, class-specific `const Object()` as the `token`. - PlatformInterface({@required Object token}) : _instanceToken = token; + PlatformInterface({required Object token}) : _instanceToken = token; final Object _instanceToken; diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index ae11b144ca8c..b1454bb82d1e 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -12,17 +12,20 @@ description: Reusable base class for Flutter plugin platform interfaces. # be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version # that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: # `plugin_platform_interface: >=1.X.Y <3.0.0`). -version: 1.0.3 +version: 1.1.0-nullsafety repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.10.0-56.0.dev <3.0.0' + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none dependencies: - meta: ^1.0.0 + meta: ^1.3.0-nullsafety.3 dev_dependencies: mockito: ^4.1.1 - test: ^1.9.4 - pedantic: ^1.8.0 + test: ^1.10.0-nullsafety.1 + pedantic: ^1.10.0-nullsafety.1 diff --git a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart index 0488c20f3efb..b07dd4dcede1 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// TODO(egarciad): Remove once Mockito is migrated to null safety. +// @dart = 2.9 import 'package:mockito/mockito.dart'; import 'package:test/test.dart'; From 3971a20203784f221e2ee725a883874e78c2968d Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 13 Oct 2020 19:07:56 -0700 Subject: [PATCH 02/58] Configure analyzer for plugins that are migrated to nnbd (#3150) --- analysis_options.yaml | 2 -- packages/plugin_platform_interface/analysis_options.yaml | 4 ++++ script/incremental_build.sh | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 packages/plugin_platform_interface/analysis_options.yaml diff --git a/analysis_options.yaml b/analysis_options.yaml index d771f8481ce5..b1261f36fac9 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,7 +1,5 @@ include: package:pedantic/analysis_options.1.8.0.yaml analyzer: - enable-experiment: - - non-nullable exclude: # Ignore generated files - '**/*.g.dart' diff --git a/packages/plugin_platform_interface/analysis_options.yaml b/packages/plugin_platform_interface/analysis_options.yaml new file mode 100644 index 000000000000..f4819cd5c313 --- /dev/null +++ b/packages/plugin_platform_interface/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 30c166b4c666..c65d1d11eadc 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -22,6 +22,7 @@ fi CUSTOM_ANALYSIS_PLUGINS=( "in_app_purchase" "camera" + "plugin_platform_interface" "video_player/video_player_web" "google_maps_flutter/google_maps_flutter_web" ) From ab36fed60679b6c29cfa5a462179e513765bb8fe Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Thu, 15 Oct 2020 19:57:27 +0200 Subject: [PATCH 03/58] [url_launcher] Url launcher platform interface null safety (#3142) --- .../CHANGELOG.md | 4 +++ .../analysis_options.yaml | 4 +++ .../lib/method_channel_url_launcher.dart | 19 +++++++------- .../lib/url_launcher_platform_interface.dart | 15 +++++------ .../pubspec.yaml | 14 ++++++---- .../method_channel_url_launcher_test.dart | 26 +++++++++++++++++++ script/incremental_build.sh | 1 + 7 files changed, 60 insertions(+), 23 deletions(-) create mode 100644 packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml diff --git a/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md b/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md index 768042be4cef..f5bb44fb2423 100644 --- a/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety + +* Migrate to null safety. + ## 1.0.8 * Added webOnlyWindowName parameter diff --git a/packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml b/packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml new file mode 100644 index 000000000000..32ff54f2748c --- /dev/null +++ b/packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable \ No newline at end of file diff --git a/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart b/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart index f87630ee3045..1d66a4cc633c 100644 --- a/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart +++ b/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart @@ -5,7 +5,6 @@ import 'dart:async'; import 'package:flutter/services.dart'; -import 'package:meta/meta.dart' show required; import 'url_launcher_platform_interface.dart'; @@ -18,7 +17,7 @@ class MethodChannelUrlLauncher extends UrlLauncherPlatform { return _channel.invokeMethod( 'canLaunch', {'url': url}, - ); + ).then((value) => value ?? false); } @override @@ -29,13 +28,13 @@ class MethodChannelUrlLauncher extends UrlLauncherPlatform { @override Future launch( String url, { - @required bool useSafariVC, - @required bool useWebView, - @required bool enableJavaScript, - @required bool enableDomStorage, - @required bool universalLinksOnly, - @required Map headers, - String webOnlyWindowName, + required bool useSafariVC, + required bool useWebView, + required bool enableJavaScript, + required bool enableDomStorage, + required bool universalLinksOnly, + required Map headers, + String? webOnlyWindowName, }) { return _channel.invokeMethod( 'launch', @@ -48,6 +47,6 @@ class MethodChannelUrlLauncher extends UrlLauncherPlatform { 'universalLinksOnly': universalLinksOnly, 'headers': headers, }, - ); + ).then((value) => value ?? false); } } diff --git a/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart b/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart index 1de5742c1f6f..fae84c96f3ce 100644 --- a/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart +++ b/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart @@ -4,7 +4,6 @@ import 'dart:async'; -import 'package:meta/meta.dart' show required; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'method_channel_url_launcher.dart'; @@ -49,13 +48,13 @@ abstract class UrlLauncherPlatform extends PlatformInterface { /// in `package:url_launcher/url_launcher.dart`. Future launch( String url, { - @required bool useSafariVC, - @required bool useWebView, - @required bool enableJavaScript, - @required bool enableDomStorage, - @required bool universalLinksOnly, - @required Map headers, - String webOnlyWindowName, + required bool useSafariVC, + required bool useWebView, + required bool enableJavaScript, + required bool enableDomStorage, + required bool universalLinksOnly, + required Map headers, + String? webOnlyWindowName, }) { throw UnimplementedError('launch() has not been implemented.'); } diff --git a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml index 0c4096278bcb..823456854872 100644 --- a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml +++ b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml @@ -3,20 +3,24 @@ description: A common platform interface for the url_launcher plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_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.8 +version: 2.0.0-nullsafety dependencies: flutter: sdk: flutter - meta: ^1.0.5 - plugin_platform_interface: ^1.0.1 + # TODO (mvanbeusekom): use pub.dev once 1.10.0-nullsafety released. + plugin_platform_interface: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/plugin_platform_interface dev_dependencies: flutter_test: sdk: flutter mockito: ^4.1.1 - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.10.0-56.0.dev <3.0.0' flutter: ">=1.9.1+hotfix.4 <2.0.0" diff --git a/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart b/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart index 628ab48498ec..7923e9fdaaf8 100644 --- a/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart +++ b/packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// TODO(mvanbeusekom): Remove once Mockito is migrated to null safety. +// @dart = 2.9 import 'package:mockito/mockito.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -41,6 +43,10 @@ void main() { final List log = []; channel.setMockMethodCallHandler((MethodCall methodCall) async { log.add(methodCall); + + // Return null explicitly instead of relying on the implicit null + // returned by the method channel if no return statement is specified. + return null; }); final MethodChannelUrlLauncher launcher = MethodChannelUrlLauncher(); @@ -61,6 +67,12 @@ void main() { ); }); + test('canLaunch should return false if platform returns null', () async { + final canLaunch = await launcher.canLaunch('http://example.com/'); + + expect(canLaunch, false); + }); + test('launch', () async { await launcher.launch( 'http://example.com/', @@ -269,6 +281,20 @@ void main() { ); }); + test('launch should return false if platform returns null', () async { + final launched = await launcher.launch( + 'http://example.com/', + useSafariVC: true, + useWebView: false, + enableJavaScript: false, + enableDomStorage: false, + universalLinksOnly: false, + headers: const {}, + ); + + expect(launched, false); + }); + test('closeWebView default behavior', () async { await launcher.closeWebView(); expect( diff --git a/script/incremental_build.sh b/script/incremental_build.sh index c65d1d11eadc..c435674b7109 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -25,6 +25,7 @@ CUSTOM_ANALYSIS_PLUGINS=( "plugin_platform_interface" "video_player/video_player_web" "google_maps_flutter/google_maps_flutter_web" + "url_launcher/url_launcher_platform_interface" ) # Comma-separated string of the list above readonly CUSTOM_FLAG=$(IFS=, ; echo "${CUSTOM_ANALYSIS_PLUGINS[*]}") From b1fb69e830896a1f78158c734e4de97ce32123c2 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Thu, 15 Oct 2020 10:59:16 -0700 Subject: [PATCH 04/58] EOF missing in analysis_options.yaml --- .../url_launcher_platform_interface/analysis_options.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml b/packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml index 32ff54f2748c..3d64bb57fe49 100644 --- a/packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml +++ b/packages/url_launcher/url_launcher_platform_interface/analysis_options.yaml @@ -1,4 +1,4 @@ include: ../../../analysis_options.yaml analyzer: enable-experiment: - - non-nullable \ No newline at end of file + - non-nullable From ce3b264e6bb3a53e07eb91371f3b621c08091aef Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Thu, 15 Oct 2020 18:36:00 -0700 Subject: [PATCH 05/58] [video_player_platform_interface] Migrate to null safety (#3159) --- .../flutter/plugins/videoplayer/Messages.java | 4 +- .../video_player/ios/Classes/messages.h | 2 +- .../video_player/ios/Classes/messages.m | 36 ++- .../CHANGELOG.md | 4 + .../analysis_options.yaml | 4 + .../lib/messages.dart | 273 ++++++++++-------- .../lib/method_channel_video_player.dart | 4 +- .../lib/video_player_platform_interface.dart | 22 +- .../pubspec.yaml | 11 +- .../method_channel_video_player_test.dart | 4 + script/incremental_build.sh | 1 + 11 files changed, 201 insertions(+), 164 deletions(-) create mode 100644 packages/video_player/video_player_platform_interface/analysis_options.yaml diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java index 78da7150edf0..98cf6dbaacea 100644 --- a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java +++ b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.7), do not edit directly. +// Autogenerated from Pigeon (v0.1.12), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.videoplayer; @@ -597,7 +597,7 @@ static void setup(BinaryMessenger binaryMessenger, VideoPlayerApi api) { private static HashMap wrapError(Exception exception) { HashMap errorMap = new HashMap<>(); errorMap.put("message", exception.toString()); - errorMap.put("code", null); + errorMap.put("code", exception.getClass().getSimpleName()); errorMap.put("details", null); return errorMap; } diff --git a/packages/video_player/video_player/ios/Classes/messages.h b/packages/video_player/video_player/ios/Classes/messages.h index 3c68b3dd24d4..84e8fc5e5cff 100644 --- a/packages/video_player/video_player/ios/Classes/messages.h +++ b/packages/video_player/video_player/ios/Classes/messages.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.7), do not edit directly. +// Autogenerated from Pigeon (v0.1.12), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @protocol FlutterBinaryMessenger; diff --git a/packages/video_player/video_player/ios/Classes/messages.m b/packages/video_player/video_player/ios/Classes/messages.m index e71f8b89254d..58ff7292d2b2 100644 --- a/packages/video_player/video_player/ios/Classes/messages.m +++ b/packages/video_player/video_player/ios/Classes/messages.m @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.7), do not edit directly. +// Autogenerated from Pigeon (v0.1.12), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "messages.h" #import @@ -7,6 +7,7 @@ #error File requires ARC to be enabled. #endif +#ifndef __clang_analyzer__ static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) { NSDictionary *errorDict = (NSDictionary *)[NSNull null]; if (error) { @@ -59,9 +60,9 @@ + (FLTTextureMessage *)fromMap:(NSDictionary *)dict { return result; } - (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", nil]; + return + [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), + @"textureId", nil]; } @end @@ -112,10 +113,9 @@ + (FLTLoopingMessage *)fromMap:(NSDictionary *)dict { } - (NSDictionary *)toMap { return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", - (self.isLooping != nil ? self.isLooping : [NSNull null]), - @"isLooping", nil]; + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.isLooping ? self.isLooping : [NSNull null]), @"isLooping", + nil]; } @end @@ -134,9 +134,8 @@ + (FLTVolumeMessage *)fromMap:(NSDictionary *)dict { } - (NSDictionary *)toMap { return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", (self.volume != nil ? self.volume : [NSNull null]), - @"volume", nil]; + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.volume ? self.volume : [NSNull null]), @"volume", nil]; } @end @@ -155,9 +154,8 @@ + (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict { } - (NSDictionary *)toMap { return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", (self.speed != nil ? self.speed : [NSNull null]), - @"speed", nil]; + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.speed ? self.speed : [NSNull null]), @"speed", nil]; } @end @@ -176,10 +174,9 @@ + (FLTPositionMessage *)fromMap:(NSDictionary *)dict { } - (NSDictionary *)toMap { return [NSDictionary - dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]), - @"textureId", - (self.position != nil ? self.position : [NSNull null]), - @"position", nil]; + dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId", + (self.position ? self.position : [NSNull null]), @"position", + nil]; } @end @@ -194,7 +191,7 @@ + (FLTMixWithOthersMessage *)fromMap:(NSDictionary *)dict { } - (NSDictionary *)toMap { return [NSDictionary - dictionaryWithObjectsAndKeys:(self.mixWithOthers != nil ? self.mixWithOthers : [NSNull null]), + dictionaryWithObjectsAndKeys:(self.mixWithOthers ? self.mixWithOthers : [NSNull null]), @"mixWithOthers", nil]; } @end @@ -365,3 +362,4 @@ void FLTVideoPlayerApiSetup(id binaryMessenger, id _toMap() { final Map pigeonMap = {}; @@ -17,9 +17,6 @@ class TextureMessage { // ignore: unused_element static TextureMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final TextureMessage result = TextureMessage(); result.textureId = pigeonMap['textureId']; return result; @@ -27,10 +24,10 @@ class TextureMessage { } class CreateMessage { - String asset; - String uri; - String packageName; - String formatHint; + String? asset; + String? uri; + String? packageName; + String? formatHint; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -43,9 +40,6 @@ class CreateMessage { // ignore: unused_element static CreateMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final CreateMessage result = CreateMessage(); result.asset = pigeonMap['asset']; result.uri = pigeonMap['uri']; @@ -56,8 +50,8 @@ class CreateMessage { } class LoopingMessage { - int textureId; - bool isLooping; + int? textureId; + bool? isLooping; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -68,9 +62,6 @@ class LoopingMessage { // ignore: unused_element static LoopingMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final LoopingMessage result = LoopingMessage(); result.textureId = pigeonMap['textureId']; result.isLooping = pigeonMap['isLooping']; @@ -79,8 +70,8 @@ class LoopingMessage { } class VolumeMessage { - int textureId; - double volume; + int? textureId; + double? volume; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -91,9 +82,6 @@ class VolumeMessage { // ignore: unused_element static VolumeMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final VolumeMessage result = VolumeMessage(); result.textureId = pigeonMap['textureId']; result.volume = pigeonMap['volume']; @@ -102,8 +90,8 @@ class VolumeMessage { } class PlaybackSpeedMessage { - int textureId; - double speed; + int? textureId; + double? speed; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -114,9 +102,6 @@ class PlaybackSpeedMessage { // ignore: unused_element static PlaybackSpeedMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final PlaybackSpeedMessage result = PlaybackSpeedMessage(); result.textureId = pigeonMap['textureId']; result.speed = pigeonMap['speed']; @@ -125,8 +110,8 @@ class PlaybackSpeedMessage { } class PositionMessage { - int textureId; - int position; + int? textureId; + int? position; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -137,9 +122,6 @@ class PositionMessage { // ignore: unused_element static PositionMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final PositionMessage result = PositionMessage(); result.textureId = pigeonMap['textureId']; result.position = pigeonMap['position']; @@ -148,7 +130,7 @@ class PositionMessage { } class MixWithOthersMessage { - bool mixWithOthers; + bool? mixWithOthers; // ignore: unused_element Map _toMap() { final Map pigeonMap = {}; @@ -158,9 +140,6 @@ class MixWithOthersMessage { // ignore: unused_element static MixWithOthersMessage _fromMap(Map pigeonMap) { - if (pigeonMap == null) { - return null; - } final MixWithOthersMessage result = MixWithOthersMessage(); result.mixWithOthers = pigeonMap['mixWithOthers']; return result; @@ -172,7 +151,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); - final Map replyMap = await channel.send(null); + final Map? replyMap = await channel.send(null); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -194,7 +173,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -216,7 +195,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -238,7 +217,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -260,7 +239,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -283,7 +262,7 @@ class VideoPlayerApi { 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -305,7 +284,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -327,7 +306,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -349,7 +328,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -371,7 +350,7 @@ class VideoPlayerApi { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -394,7 +373,7 @@ class VideoPlayerApi { 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', StandardMessageCodec()); - final Map replyMap = await channel.send(requestMap); + final Map? replyMap = await channel.send(requestMap); if (replyMap == null) { throw PlatformException( code: 'channel-error', @@ -424,131 +403,175 @@ abstract class TestHostVideoPlayerApi { void seekTo(PositionMessage arg); void pause(TextureMessage arg); void setMixWithOthers(MixWithOthersMessage arg); - static void setup(TestHostVideoPlayerApi api) { + static void setup(TestHostVideoPlayerApi? api) { { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - api.initialize(); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + api.initialize(); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final CreateMessage input = CreateMessage._fromMap(mapMessage); - final TextureMessage output = api.create(input); - return {'result': output._toMap()}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final CreateMessage input = CreateMessage._fromMap(mapMessage); + final TextureMessage output = api.create(input); + return {'result': output._toMap()}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - api.dispose(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + api.dispose(input); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final LoopingMessage input = LoopingMessage._fromMap(mapMessage); - api.setLooping(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final LoopingMessage input = LoopingMessage._fromMap(mapMessage); + api.setLooping(input); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final VolumeMessage input = VolumeMessage._fromMap(mapMessage); - api.setVolume(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final VolumeMessage input = VolumeMessage._fromMap(mapMessage); + api.setVolume(input); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final PlaybackSpeedMessage input = - PlaybackSpeedMessage._fromMap(mapMessage); - api.setPlaybackSpeed(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final PlaybackSpeedMessage input = + PlaybackSpeedMessage._fromMap(mapMessage); + api.setPlaybackSpeed(input); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - api.play(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + api.play(input); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - final PositionMessage output = api.position(input); - return {'result': output._toMap()}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + final PositionMessage output = api.position(input); + return {'result': output._toMap()}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final PositionMessage input = PositionMessage._fromMap(mapMessage); - api.seekTo(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final PositionMessage input = PositionMessage._fromMap(mapMessage); + api.seekTo(input); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final TextureMessage input = TextureMessage._fromMap(mapMessage); - api.pause(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final TextureMessage input = TextureMessage._fromMap(mapMessage); + api.pause(input); + return {}; + }); + } } { const BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers', StandardMessageCodec()); - channel.setMockMessageHandler((dynamic message) async { - final Map mapMessage = - message as Map; - final MixWithOthersMessage input = - MixWithOthersMessage._fromMap(mapMessage); - api.setMixWithOthers(input); - return {}; - }); + if (api == null) { + channel.setMockMessageHandler(null); + } else { + channel.setMockMessageHandler((dynamic message) async { + final Map mapMessage = + message as Map; + final MixWithOthersMessage input = + MixWithOthersMessage._fromMap(mapMessage); + api.setMixWithOthers(input); + return {}; + }); + } } } } diff --git a/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart b/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart index 0ea443fb6e12..9b007d00d6a9 100644 --- a/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart +++ b/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart @@ -26,7 +26,7 @@ class MethodChannelVideoPlayer extends VideoPlayerPlatform { } @override - Future create(DataSource dataSource) async { + Future create(DataSource dataSource) async { CreateMessage message = CreateMessage(); switch (dataSource.sourceType) { @@ -91,7 +91,7 @@ class MethodChannelVideoPlayer extends VideoPlayerPlatform { Future getPosition(int textureId) async { PositionMessage response = await _api.position(TextureMessage()..textureId = textureId); - return Duration(milliseconds: response.position); + return Duration(milliseconds: response.position!); } @override diff --git a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart index 2757fb135af6..7b472dc8d442 100644 --- a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart +++ b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart @@ -7,7 +7,7 @@ import 'dart:ui'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; -import 'package:meta/meta.dart' show required, visibleForTesting; +import 'package:meta/meta.dart' show visibleForTesting; import 'method_channel_video_player.dart'; @@ -66,7 +66,7 @@ abstract class VideoPlayerPlatform { } /// Creates an instance of a video player and returns its textureId. - Future create(DataSource dataSource) { + Future create(DataSource dataSource) { throw UnimplementedError('create() has not been implemented.'); } @@ -146,8 +146,8 @@ class DataSource { /// The [package] argument must be non-null when the asset comes from a /// package and null otherwise. DataSource({ - @required this.sourceType, - this.uri, + required this.sourceType, + required this.uri, this.formatHint, this.asset, this.package, @@ -167,14 +167,14 @@ class DataSource { /// **Android only**. Will override the platform's generic file format /// detection with whatever is set here. - final VideoFormat formatHint; + final VideoFormat? formatHint; /// The name of the asset. Only set for [DataSourceType.asset] videos. - final String asset; + final String? asset; /// The package that the asset was loaded from. Only set for /// [DataSourceType.asset] videos. - final String package; + final String? package; } /// The way in which the video was originally loaded. @@ -216,7 +216,7 @@ class VideoEvent { /// Depending on the [eventType], the [duration], [size] and [buffered] /// arguments can be null. VideoEvent({ - @required this.eventType, + required this.eventType, this.duration, this.size, this.buffered, @@ -228,17 +228,17 @@ class VideoEvent { /// Duration of the video. /// /// Only used if [eventType] is [VideoEventType.initialized]. - final Duration duration; + final Duration? duration; /// Size of the video. /// /// Only used if [eventType] is [VideoEventType.initialized]. - final Size size; + final Size? size; /// Buffered parts of the video. /// /// Only used if [eventType] is [VideoEventType.bufferingUpdate]. - final List buffered; + final List? buffered; @override bool operator ==(Object other) { diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml index cc3cd79f1f33..d86a3b9132e3 100644 --- a/packages/video_player/video_player_platform_interface/pubspec.yaml +++ b/packages/video_player/video_player_platform_interface/pubspec.yaml @@ -3,19 +3,22 @@ description: A common platform interface for the video_player plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_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: 2.2.0 +version: 3.0.0-nullsafety dependencies: flutter: sdk: flutter - meta: ^1.0.5 + meta: ^1.3.0-nullsafety.3 dev_dependencies: flutter_test: sdk: flutter mockito: ^4.1.1 - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none environment: - sdk: ">=2.8.0 <3.0.0" + sdk: ">=2.10.0-56.0.dev <3.0.0" flutter: ">=1.10.0 <2.0.0" diff --git a/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart b/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart index c4791001ad92..4db58770c629 100644 --- a/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart +++ b/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart @@ -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(egarciad): Remove once Mockito is migrated to null safety. +// @dart = 2.9 + import 'dart:ui'; import 'package:flutter/services.dart'; @@ -142,6 +145,7 @@ void main() { test('create with asset', () async { final int textureId = await player.create(DataSource( sourceType: DataSourceType.asset, + uri: 'someUri', asset: 'someAsset', package: 'somePackage', )); diff --git a/script/incremental_build.sh b/script/incremental_build.sh index c435674b7109..acbc61177940 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -23,6 +23,7 @@ CUSTOM_ANALYSIS_PLUGINS=( "in_app_purchase" "camera" "plugin_platform_interface" + "video_player/video_player_platform_interface" "video_player/video_player_web" "google_maps_flutter/google_maps_flutter_web" "url_launcher/url_launcher_platform_interface" From f98493d0ac695005428953f74b3971be4c6570d4 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 16 Oct 2020 13:48:13 -0700 Subject: [PATCH 06/58] [device_info_platform_interface][device_info] nnbd (#3144) --- packages/device_info/device_info/CHANGELOG.md | 4 + .../device_info/analysis_options.yaml | 4 + .../integration_test/device_info_test.dart | 2 + .../device_info/example/lib/main.dart | 2 +- .../device_info/example/pubspec.yaml | 5 +- .../example/test_driver/integration_test.dart | 2 + .../device_info/lib/device_info.dart | 4 +- packages/device_info/device_info/pubspec.yaml | 14 ++- .../CHANGELOG.md | 4 + .../analysis_options.yaml | 4 + .../lib/model/android_device_info.dart | 104 +++++++++--------- .../lib/model/ios_device_info.dart | 48 ++++---- .../pubspec.yaml | 16 ++- .../test/method_channel_device_info_test.dart | 2 + script/incremental_build.sh | 2 + 15 files changed, 126 insertions(+), 91 deletions(-) create mode 100644 packages/device_info/device_info/analysis_options.yaml create mode 100644 packages/device_info/device_info_platform_interface/analysis_options.yaml diff --git a/packages/device_info/device_info/CHANGELOG.md b/packages/device_info/device_info/CHANGELOG.md index 836d56232f95..bf179e645ee1 100644 --- a/packages/device_info/device_info/CHANGELOG.md +++ b/packages/device_info/device_info/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0-nullsafety + +* Migrate to null safety. + ## 0.4.2+9 * Update android compileSdkVersion to 29. diff --git a/packages/device_info/device_info/analysis_options.yaml b/packages/device_info/device_info/analysis_options.yaml new file mode 100644 index 000000000000..3d64bb57fe49 --- /dev/null +++ b/packages/device_info/device_info/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable diff --git a/packages/device_info/device_info/example/integration_test/device_info_test.dart b/packages/device_info/device_info/example/integration_test/device_info_test.dart index 2fd1d9a9a491..33b745af13f9 100644 --- a/packages/device_info/device_info/example/integration_test/device_info_test.dart +++ b/packages/device_info/device_info/example/integration_test/device_info_test.dart @@ -2,6 +2,8 @@ // 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'; diff --git a/packages/device_info/device_info/example/lib/main.dart b/packages/device_info/device_info/example/lib/main.dart index 1c1064aa09ee..3aded93809b3 100644 --- a/packages/device_info/device_info/example/lib/main.dart +++ b/packages/device_info/device_info/example/lib/main.dart @@ -36,7 +36,7 @@ class _MyAppState extends State { } Future initPlatformState() async { - Map deviceData; + Map deviceData = {}; try { if (Platform.isAndroid) { diff --git a/packages/device_info/device_info/example/pubspec.yaml b/packages/device_info/device_info/example/pubspec.yaml index e22f6026ba69..9a9556ab5543 100644 --- a/packages/device_info/device_info/example/pubspec.yaml +++ b/packages/device_info/device_info/example/pubspec.yaml @@ -12,7 +12,10 @@ 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.10.0-56.0.dev <3.0.0' diff --git a/packages/device_info/device_info/example/test_driver/integration_test.dart b/packages/device_info/device_info/example/test_driver/integration_test.dart index 7a2c21338786..bd3dc09c190c 100644 --- a/packages/device_info/device_info/example/test_driver/integration_test.dart +++ b/packages/device_info/device_info/example/test_driver/integration_test.dart @@ -2,6 +2,8 @@ // 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'; diff --git a/packages/device_info/device_info/lib/device_info.dart b/packages/device_info/device_info/lib/device_info.dart index f63730c4323f..bccc3d2fbfa6 100644 --- a/packages/device_info/device_info/lib/device_info.dart +++ b/packages/device_info/device_info/lib/device_info.dart @@ -15,7 +15,7 @@ class DeviceInfoPlugin { DeviceInfoPlugin(); /// This information does not change from call to call. Cache it. - AndroidDeviceInfo _cachedAndroidDeviceInfo; + AndroidDeviceInfo? _cachedAndroidDeviceInfo; /// Information derived from `android.os.Build`. /// @@ -25,7 +25,7 @@ class DeviceInfoPlugin { await DeviceInfoPlatform.instance.androidInfo(); /// This information does not change from call to call. Cache it. - IosDeviceInfo _cachedIosDeviceInfo; + IosDeviceInfo? _cachedIosDeviceInfo; /// Information derived from `UIDevice`. /// diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index bf36bf6f34d9..473d079a0e4f 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -5,7 +5,10 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.4.2+9 +version: 0.5.0-nullsafety + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none flutter: plugin: @@ -19,14 +22,15 @@ flutter: dependencies: flutter: sdk: flutter - device_info_platform_interface: ^1.0.0 + device_info_platform_interface: + path: ../device_info_platform_interface dev_dependencies: - test: ^1.3.0 + test: ^1.10.0-nullsafety.1 flutter_test: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 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" diff --git a/packages/device_info/device_info_platform_interface/CHANGELOG.md b/packages/device_info/device_info_platform_interface/CHANGELOG.md index 8a7eb6c46be3..f48c0a9cee21 100644 --- a/packages/device_info/device_info_platform_interface/CHANGELOG.md +++ b/packages/device_info/device_info_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.0-nullsafety + +* Migrate to null safety. + ## 1.0.1 - Documentation typo fixed. diff --git a/packages/device_info/device_info_platform_interface/analysis_options.yaml b/packages/device_info/device_info_platform_interface/analysis_options.yaml new file mode 100644 index 000000000000..32ff54f2748c --- /dev/null +++ b/packages/device_info/device_info_platform_interface/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable \ No newline at end of file diff --git a/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart b/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart index 5b326cc5350a..ea5839da14d3 100644 --- a/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart +++ b/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart @@ -8,28 +8,28 @@ class AndroidDeviceInfo { /// Android device Info class. AndroidDeviceInfo({ - this.version, - this.board, - this.bootloader, - this.brand, - this.device, - this.display, - this.fingerprint, - this.hardware, - this.host, - this.id, - this.manufacturer, - this.model, - this.product, - List supported32BitAbis, - List supported64BitAbis, - List supportedAbis, - this.tags, - this.type, - this.isPhysicalDevice, - this.androidId, - List systemFeatures, - }) : supported32BitAbis = List.unmodifiable(supported32BitAbis), + required this.version, + required this.board, + required this.bootloader, + required this.brand, + required this.device, + required this.display, + required this.fingerprint, + required this.hardware, + required this.host, + required this.id, + required this.manufacturer, + required this.model, + required this.product, + required List supported32BitAbis, + required List supported64BitAbis, + required List supportedAbis, + required this.tags, + required this.type, + required this.isPhysicalDevice, + required this.androidId, + required List systemFeatures, + }) : supported32BitAbis = List.unmodifiable(supported32BitAbis), supported64BitAbis = List.unmodifiable(supported64BitAbis), supportedAbis = List.unmodifiable(supportedAbis), systemFeatures = List.unmodifiable(systemFeatures); @@ -115,25 +115,25 @@ class AndroidDeviceInfo { return AndroidDeviceInfo( version: AndroidBuildVersion._fromMap( map['version']?.cast() ?? {}), - board: map['board'], - bootloader: map['bootloader'], - brand: map['brand'], - device: map['device'], - display: map['display'], - fingerprint: map['fingerprint'], - hardware: map['hardware'], - host: map['host'], - id: map['id'], - manufacturer: map['manufacturer'], - model: map['model'], - product: map['product'], + board: map['board'] ?? '', + bootloader: map['bootloader'] ?? '', + brand: map['brand'] ?? '', + device: map['device'] ?? '', + display: map['display'] ?? '', + fingerprint: map['fingerprint'] ?? '', + hardware: map['hardware'] ?? '', + host: map['host'] ?? '', + id: map['id'] ?? '', + manufacturer: map['manufacturer'] ?? '', + model: map['model'] ?? '', + product: map['product'] ?? '', supported32BitAbis: _fromList(map['supported32BitAbis'] ?? []), supported64BitAbis: _fromList(map['supported64BitAbis'] ?? []), supportedAbis: _fromList(map['supportedAbis'] ?? []), - tags: map['tags'], - type: map['type'], - isPhysicalDevice: map['isPhysicalDevice'], - androidId: map['androidId'], + tags: map['tags'] ?? '', + type: map['type'] ?? '', + isPhysicalDevice: map['isPhysicalDevice'] ?? false, + androidId: map['androidId'] ?? '', systemFeatures: _fromList(map['systemFeatures'] ?? []), ); } @@ -151,13 +151,13 @@ class AndroidDeviceInfo { /// See: https://developer.android.com/reference/android/os/Build.VERSION.html class AndroidBuildVersion { AndroidBuildVersion._({ - this.baseOS, - this.codename, - this.incremental, - this.previewSdkInt, - this.release, - this.sdkInt, - this.securityPatch, + required this.baseOS, + required this.codename, + required this.incremental, + required this.previewSdkInt, + required this.release, + required this.sdkInt, + required this.securityPatch, }); /// The base OS build the product is based on. @@ -186,13 +186,13 @@ class AndroidBuildVersion { /// Deserializes from the map message received from [_kChannel]. static AndroidBuildVersion _fromMap(Map map) { return AndroidBuildVersion._( - baseOS: map['baseOS'], - codename: map['codename'], - incremental: map['incremental'], - previewSdkInt: map['previewSdkInt'], - release: map['release'], - sdkInt: map['sdkInt'], - securityPatch: map['securityPatch'], + baseOS: map['baseOS'] ?? '', + codename: map['codename'] ?? '', + incremental: map['incremental'] ?? '', + previewSdkInt: map['previewSdkInt'] ?? 0, + release: map['release'] ?? '', + sdkInt: map['sdkInt'] ?? 0, + securityPatch: map['securityPatch'] ?? '', ); } } diff --git a/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart b/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart index d41202492101..f909fadd20ae 100644 --- a/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart +++ b/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart @@ -8,14 +8,14 @@ class IosDeviceInfo { /// IOS device info class. IosDeviceInfo({ - this.name, - this.systemName, - this.systemVersion, - this.model, - this.localizedModel, - this.identifierForVendor, - this.isPhysicalDevice, - this.utsname, + required this.name, + required this.systemName, + required this.systemVersion, + required this.model, + required this.localizedModel, + required this.identifierForVendor, + required this.isPhysicalDevice, + required this.utsname, }); /// Device name. @@ -45,12 +45,12 @@ class IosDeviceInfo { /// Deserializes from the map message received from [_kChannel]. static IosDeviceInfo fromMap(Map map) { return IosDeviceInfo( - name: map['name'], - systemName: map['systemName'], - systemVersion: map['systemVersion'], - model: map['model'], - localizedModel: map['localizedModel'], - identifierForVendor: map['identifierForVendor'], + name: map['name'] ?? '', + systemName: map['systemName'] ?? '', + systemVersion: map['systemVersion'] ?? '', + model: map['model'] ?? '', + localizedModel: map['localizedModel'] ?? '', + identifierForVendor: map['identifierForVendor'] ?? '', isPhysicalDevice: map['isPhysicalDevice'] == 'true', utsname: IosUtsname._fromMap(map['utsname']?.cast() ?? {}), @@ -62,11 +62,11 @@ class IosDeviceInfo { /// See http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysutsname.h.html for details. class IosUtsname { IosUtsname._({ - this.sysname, - this.nodename, - this.release, - this.version, - this.machine, + required this.sysname, + required this.nodename, + required this.release, + required this.version, + required this.machine, }); /// Operating system name. @@ -87,11 +87,11 @@ class IosUtsname { /// Deserializes from the map message received from [_kChannel]. static IosUtsname _fromMap(Map map) { return IosUtsname._( - sysname: map['sysname'], - nodename: map['nodename'], - release: map['release'], - version: map['version'], - machine: map['machine'], + sysname: map['sysname'] ?? '', + nodename: map['nodename'] ?? '', + release: map['release'] ?? '', + version: map['version'] ?? '', + machine: map['machine'] ?? '', ); } } diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 656e5b24c373..54ab561c87ec 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -3,20 +3,24 @@ description: A common platform interface for the device_info plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 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.1 +version: 1.1.0-nullsafety + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none dependencies: flutter: sdk: flutter - meta: ^1.1.8 - plugin_platform_interface: ^1.0.2 + meta: ^1.3.0-nullsafety.3 + plugin_platform_interface: + path: ../../plugin_platform_interface dev_dependencies: flutter_test: sdk: flutter - mockito: ^4.1.1 - pedantic: ^1.8.0 + test: ^1.10.0-nullsafety.1 + pedantic: ^1.10.0-nullsafety.1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.10.0-56.0.dev <3.0.0' flutter: ">=1.9.1+hotfix.4 <2.0.0" diff --git a/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart b/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart index 1da52e2cf39f..dfc833da7e79 100644 --- a/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart +++ b/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart @@ -2,6 +2,8 @@ // 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 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/script/incremental_build.sh b/script/incremental_build.sh index acbc61177940..3690b569bec0 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -27,6 +27,8 @@ CUSTOM_ANALYSIS_PLUGINS=( "video_player/video_player_web" "google_maps_flutter/google_maps_flutter_web" "url_launcher/url_launcher_platform_interface" + "device_info/device_info_platform_interface" + "device_info/device_info" ) # Comma-separated string of the list above readonly CUSTOM_FLAG=$(IFS=, ; echo "${CUSTOM_ANALYSIS_PLUGINS[*]}") From 5b049f44c0668e47e7723a104d008f484c616d3a Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Sun, 18 Oct 2020 09:57:29 -0700 Subject: [PATCH 07/58] [device_info][device_info_platform_interface] update to git deps (#3164) --- packages/device_info/device_info/pubspec.yaml | 6 ++++-- .../device_info/device_info_platform_interface/pubspec.yaml | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index 473d079a0e4f..b45124095832 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -23,8 +23,10 @@ dependencies: flutter: sdk: flutter device_info_platform_interface: - path: ../device_info_platform_interface - + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/device_info/device_info_platform_interface dev_dependencies: test: ^1.10.0-nullsafety.1 flutter_test: diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 54ab561c87ec..666e0c529ebd 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -13,7 +13,10 @@ dependencies: sdk: flutter meta: ^1.3.0-nullsafety.3 plugin_platform_interface: - path: ../../plugin_platform_interface + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/plugin_platform_interface dev_dependencies: flutter_test: From 7dd61d9363d9d5dfb61d917a5f8b72b3ee4ddfd7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Mon, 19 Oct 2020 22:08:19 -0700 Subject: [PATCH 08/58] [video_player] Migrate video player to null safety (#3165) * Migrate video player to null safety * Fixes * Double quotes -> single quotes * Format and lint * feedback * Test example app * Fix analyzer --- .../video_player/video_player/CHANGELOG.md | 4 + .../video_player/analysis_options.yaml | 4 + .../integration_test/video_player_test.dart | 4 +- .../video_player/example/lib/main.dart | 11 +- .../video_player/example/pubspec.yaml | 2 +- .../example/test_driver/integration_test.dart | 3 + .../example/test_driver/video_player.dart | 3 + .../test_driver/video_player_test.dart | 3 + .../lib/src/closed_caption_file.dart | 11 +- .../video_player/lib/src/sub_rip.dart | 7 +- .../video_player/lib/video_player.dart | 167 ++++++++++-------- .../video_player/pigeons/messages.dart | 2 + .../video_player/video_player/pubspec.yaml | 21 ++- .../video_player/test/sub_rip_file_test.dart | 2 +- .../video_player_initialization_test.dart | 2 - .../video_player/test/video_player_test.dart | 92 +++++----- .../CHANGELOG.md | 4 + .../lib/video_player_platform_interface.dart | 4 +- .../pubspec.yaml | 2 +- .../method_channel_video_player_test.dart | 1 - .../video_player_web/CHANGELOG.md | 4 + .../video_player_web/analysis_options.yaml | 2 + .../lib/video_player_web.dart | 40 ++--- .../video_player_web/pubspec.yaml | 20 ++- .../test/video_player_web_test.dart | 10 +- script/incremental_build.sh | 1 + 26 files changed, 248 insertions(+), 178 deletions(-) create mode 100644 packages/video_player/video_player/analysis_options.yaml diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md index 01601c7cc44c..8c770220aef8 100644 --- a/packages/video_player/video_player/CHANGELOG.md +++ b/packages/video_player/video_player/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.12.0 + +* Migration to null safety. + ## 0.11.1+2 * Update android compileSdkVersion to 29. diff --git a/packages/video_player/video_player/analysis_options.yaml b/packages/video_player/video_player/analysis_options.yaml new file mode 100644 index 000000000000..3d64bb57fe49 --- /dev/null +++ b/packages/video_player/video_player/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable diff --git a/packages/video_player/video_player/example/integration_test/video_player_test.dart b/packages/video_player/video_player/example/integration_test/video_player_test.dart index 0953c8feb6c0..8f6daa328240 100644 --- a/packages/video_player/video_player/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player/example/integration_test/video_player_test.dart @@ -11,7 +11,7 @@ const Duration _playDuration = Duration(seconds: 1); void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - VideoPlayerController _controller; + late VideoPlayerController _controller; tearDown(() async => _controller.dispose()); group('asset videos', () { @@ -22,7 +22,7 @@ void main() { testWidgets('can be initialized', (WidgetTester tester) async { await _controller.initialize(); - expect(_controller.value.initialized, true); + expect(_controller.value.isInitialized, true); expect(_controller.value.position, const Duration(seconds: 0)); expect(_controller.value.isPlaying, false); expect(_controller.value.duration, diff --git a/packages/video_player/video_player/example/lib/main.dart b/packages/video_player/video_player/example/lib/main.dart index a99b9da6bd0c..42eaaa578fcf 100644 --- a/packages/video_player/video_player/example/lib/main.dart +++ b/packages/video_player/video_player/example/lib/main.dart @@ -108,7 +108,7 @@ class _ButterFlyAssetVideoInList extends StatelessWidget { /// A filler card to show the video in a list of scrolling contents. class _ExampleCard extends StatelessWidget { - const _ExampleCard({Key key, this.title}) : super(key: key); + const _ExampleCard({Key? key, required this.title}) : super(key: key); final String title; @@ -150,7 +150,7 @@ class _ButterFlyAssetVideo extends StatefulWidget { } class _ButterFlyAssetVideoState extends State<_ButterFlyAssetVideo> { - VideoPlayerController _controller; + late VideoPlayerController _controller; @override void initState() { @@ -206,7 +206,7 @@ class _BumbleBeeRemoteVideo extends StatefulWidget { } class _BumbleBeeRemoteVideoState extends State<_BumbleBeeRemoteVideo> { - VideoPlayerController _controller; + late VideoPlayerController _controller; Future _loadCaptions() async { final String fileContents = await DefaultAssetBundle.of(context) @@ -265,7 +265,8 @@ class _BumbleBeeRemoteVideoState extends State<_BumbleBeeRemoteVideo> { } class _ControlsOverlay extends StatelessWidget { - const _ControlsOverlay({Key key, this.controller}) : super(key: key); + const _ControlsOverlay({Key? key, required this.controller}) + : super(key: key); static const _examplePlaybackRates = [ 0.25, @@ -345,7 +346,7 @@ class _PlayerVideoAndPopPage extends StatefulWidget { } class _PlayerVideoAndPopPageState extends State<_PlayerVideoAndPopPage> { - VideoPlayerController _videoPlayerController; + late VideoPlayerController _videoPlayerController; bool startedPlaying = false; @override diff --git a/packages/video_player/video_player/example/pubspec.yaml b/packages/video_player/video_player/example/pubspec.yaml index e0afa4193dc2..eeab83533325 100644 --- a/packages/video_player/video_player/example/pubspec.yaml +++ b/packages/video_player/video_player/example/pubspec.yaml @@ -15,7 +15,7 @@ dev_dependencies: integration_test: path: ../../../integration_test test: any - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 flutter: uses-material-design: true diff --git a/packages/video_player/video_player/example/test_driver/integration_test.dart b/packages/video_player/video_player/example/test_driver/integration_test.dart index 7a2c21338786..7873abae2996 100644 --- a/packages/video_player/video_player/example/test_driver/integration_test.dart +++ b/packages/video_player/video_player/example/test_driver/integration_test.dart @@ -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(egarciad): Remove once Flutter driver is migrated to null safety. +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/video_player/video_player/example/test_driver/video_player.dart b/packages/video_player/video_player/example/test_driver/video_player.dart index cc498f41fccb..c1ced19e9b7e 100644 --- a/packages/video_player/video_player/example/test_driver/video_player.dart +++ b/packages/video_player/video_player/example/test_driver/video_player.dart @@ -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(egarciad): Remove once Flutter driver is migrated to null safety. +// @dart = 2.9 + import 'package:flutter_driver/driver_extension.dart'; import 'package:video_player_example/main.dart' as app; diff --git a/packages/video_player/video_player/example/test_driver/video_player_test.dart b/packages/video_player/video_player/example/test_driver/video_player_test.dart index 47f3867d9019..fcbdbb274f7a 100644 --- a/packages/video_player/video_player/example/test_driver/video_player_test.dart +++ b/packages/video_player/video_player/example/test_driver/video_player_test.dart @@ -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(egarciad): Remove once Flutter driver is migrated to null safety. +// @dart = 2.9 + import 'dart:async'; import 'package:flutter_driver/flutter_driver.dart'; import 'package:test/test.dart'; diff --git a/packages/video_player/video_player/lib/src/closed_caption_file.dart b/packages/video_player/video_player/lib/src/closed_caption_file.dart index 2d9242a675d5..f9d8040590b1 100644 --- a/packages/video_player/video_player/lib/src/closed_caption_file.dart +++ b/packages/video_player/video_player/lib/src/closed_caption_file.dart @@ -31,7 +31,11 @@ class Caption { /// /// This is not recommended for direct use unless you are writing a parser for /// a new closed captioning file type. - const Caption({this.number, this.start, this.end, this.text}); + const Caption( + {required this.number, + required this.start, + required this.end, + required this.text}); /// The number that this caption was assigned. final int number; @@ -45,4 +49,9 @@ class Caption { /// The actual text that should appear on screen to be read between [start] /// and [end]. final String text; + + /// A no caption object. This is a caption with [start] and [end] durations of zero, + /// and an empty [text] string. + static const Caption none = + Caption(number: 0, start: Duration.zero, end: Duration.zero, text: ''); } diff --git a/packages/video_player/video_player/lib/src/sub_rip.dart b/packages/video_player/video_player/lib/src/sub_rip.dart index 15dc43cbbd24..11456db88d09 100644 --- a/packages/video_player/video_player/lib/src/sub_rip.dart +++ b/packages/video_player/video_player/lib/src/sub_rip.dart @@ -41,8 +41,7 @@ List _parseCaptionsFromSubRipString(String file) { end: startAndEnd.end, text: text, ); - - if (newCaption.start != null && newCaption.end != null) { + if (newCaption.start != newCaption.end) { captions.add(newCaption); } } @@ -64,7 +63,7 @@ class _StartAndEnd { RegExp(_subRipTimeStamp + _subRipArrow + _subRipTimeStamp); if (!format.hasMatch(line)) { - return _StartAndEnd(null, null); + return _StartAndEnd(Duration.zero, Duration.zero); } final List times = line.split(_subRipArrow); @@ -84,7 +83,7 @@ class _StartAndEnd { // Duration(hours: 0, minutes: 1, seconds: 59, milliseconds: 084) Duration _parseSubRipTimestamp(String timestampString) { if (!RegExp(_subRipTimeStamp).hasMatch(timestampString)) { - return null; + return Duration.zero; } final List commaSections = timestampString.split(','); diff --git a/packages/video_player/video_player/lib/video_player.dart b/packages/video_player/video_player/lib/video_player.dart index ac1645085e36..6a2af76fa547 100644 --- a/packages/video_player/video_player/lib/video_player.dart +++ b/packages/video_player/video_player/lib/video_player.dart @@ -28,11 +28,12 @@ class VideoPlayerValue { /// Constructs a video with the given values. Only [duration] is required. The /// rest will initialize with default values when unset. VideoPlayerValue({ - @required this.duration, - this.size, - this.position = const Duration(), - this.caption = const Caption(), + required this.duration, + this.size = Size.zero, + this.position = Duration.zero, + this.caption = Caption.none, this.buffered = const [], + this.isInitialized = false, this.isPlaying = false, this.isLooping = false, this.isBuffering = false, @@ -41,17 +42,20 @@ class VideoPlayerValue { this.errorDescription, }); - /// Returns an instance with a `null` [Duration]. - VideoPlayerValue.uninitialized() : this(duration: null); + /// Returns an instance for a video that hasn't been loaded. + VideoPlayerValue.uninitialized() + : this(duration: Duration.zero, isInitialized: false); - /// Returns an instance with a `null` [Duration] and the given - /// [errorDescription]. + /// Returns an instance with the given [errorDescription]. VideoPlayerValue.erroneous(String errorDescription) - : this(duration: null, errorDescription: errorDescription); + : this( + duration: Duration.zero, + isInitialized: false, + errorDescription: errorDescription); /// The total duration of the video. /// - /// Is null when [initialized] is false. + /// The duration is [Duration.zero] if the video hasn't been initialized. final Duration duration; /// The current playback position. @@ -60,7 +64,7 @@ class VideoPlayerValue { /// The [Caption] that should be displayed based on the current [position]. /// /// This field will never be null. If there is no caption for the current - /// [position], this will be an empty [Caption] object. + /// [position], this will be a [Caption.none] object. final Caption caption; /// The currently buffered ranges. @@ -84,7 +88,7 @@ class VideoPlayerValue { /// A description of the error if present. /// /// If [hasError] is false this is [null]. - final String errorDescription; + final String? errorDescription; /// The [size] of the currently loaded video. /// @@ -92,7 +96,7 @@ class VideoPlayerValue { final Size size; /// Indicates whether or not the video has been loaded and is ready to play. - bool get initialized => duration != null; + final bool isInitialized; /// Indicates whether or not the video is in an error state. If this is true /// [errorDescription] should have information about the problem. @@ -101,7 +105,7 @@ class VideoPlayerValue { /// Returns [size.width] / [size.height] when size is non-null, or `1.0.` when /// size is null or the aspect ratio would be less than or equal to 0.0. double get aspectRatio { - if (size == null || size.width == 0 || size.height == 0) { + if (!isInitialized || size.width == 0 || size.height == 0) { return 1.0; } final double aspectRatio = size.width / size.height; @@ -114,17 +118,18 @@ class VideoPlayerValue { /// Returns a new instance that has the same values as this current instance, /// except for any overrides passed in as arguments to [copyWidth]. VideoPlayerValue copyWith({ - Duration duration, - Size size, - Duration position, - Caption caption, - List buffered, - bool isPlaying, - bool isLooping, - bool isBuffering, - double volume, - double playbackSpeed, - String errorDescription, + Duration? duration, + Size? size, + Duration? position, + Caption? caption, + List? buffered, + bool? isInitialized, + bool? isPlaying, + bool? isLooping, + bool? isBuffering, + double? volume, + double? playbackSpeed, + String? errorDescription, }) { return VideoPlayerValue( duration: duration ?? this.duration, @@ -132,6 +137,7 @@ class VideoPlayerValue { position: position ?? this.position, caption: caption ?? this.caption, buffered: buffered ?? this.buffered, + isInitialized: isInitialized ?? this.isInitialized, isPlaying: isPlaying ?? this.isPlaying, isLooping: isLooping ?? this.isLooping, isBuffering: isBuffering ?? this.isBuffering, @@ -149,6 +155,7 @@ class VideoPlayerValue { 'position: $position, ' 'caption: $caption, ' 'buffered: [${buffered.join(', ')}], ' + 'isInitialized: $isInitialized, ' 'isPlaying: $isPlaying, ' 'isLooping: $isLooping, ' 'isBuffering: $isBuffering, ' @@ -178,7 +185,7 @@ class VideoPlayerController extends ValueNotifier { {this.package, this.closedCaptionFile, this.videoPlayerOptions}) : dataSourceType = DataSourceType.asset, formatHint = null, - super(VideoPlayerValue(duration: null)); + super(VideoPlayerValue(duration: Duration.zero)); /// Constructs a [VideoPlayerController] playing a video from obtained from /// the network. @@ -191,7 +198,7 @@ class VideoPlayerController extends ValueNotifier { {this.formatHint, this.closedCaptionFile, this.videoPlayerOptions}) : dataSourceType = DataSourceType.network, package = null, - super(VideoPlayerValue(duration: null)); + super(VideoPlayerValue(duration: Duration.zero)); /// Constructs a [VideoPlayerController] playing a video from a file. /// @@ -203,9 +210,7 @@ class VideoPlayerController extends ValueNotifier { dataSourceType = DataSourceType.file, package = null, formatHint = null, - super(VideoPlayerValue(duration: null)); - - int _textureId; + super(VideoPlayerValue(duration: Duration.zero)); /// The URI to the video file. This will be in different formats depending on /// the [DataSourceType] of the original video. @@ -213,31 +218,36 @@ class VideoPlayerController extends ValueNotifier { /// **Android only**. Will override the platform's generic file format /// detection with whatever is set here. - final VideoFormat formatHint; + final VideoFormat? formatHint; /// Describes the type of data source this [VideoPlayerController] /// is constructed with. final DataSourceType dataSourceType; /// Provide additional configuration options (optional). Like setting the audio mode to mix - final VideoPlayerOptions videoPlayerOptions; + final VideoPlayerOptions? videoPlayerOptions; /// Only set for [asset] videos. The package that the asset was loaded from. - final String package; + final String? package; /// Optional field to specify a file containing the closed /// captioning. /// /// This future will be awaited and the file will be loaded when /// [initialize()] is called. - final Future closedCaptionFile; + final Future? closedCaptionFile; - ClosedCaptionFile _closedCaptionFile; - Timer _timer; + ClosedCaptionFile? _closedCaptionFile; + Timer? _timer; bool _isDisposed = false; - Completer _creatingCompleter; - StreamSubscription _eventSubscription; - _VideoAppLifeCycleObserver _lifeCycleObserver; + Completer? _creatingCompleter; + StreamSubscription? _eventSubscription; + late _VideoAppLifeCycleObserver _lifeCycleObserver; + + /// The id of a texture that hasn't been initialized. + @visibleForTesting + static const int kUninitializedTextureId = -1; + int _textureId = kUninitializedTextureId; /// This is just exposed for testing. It shouldn't be used by anyone depending /// on the plugin. @@ -250,7 +260,7 @@ class VideoPlayerController extends ValueNotifier { _lifeCycleObserver.initialize(); _creatingCompleter = Completer(); - DataSource dataSourceDescription; + late DataSource dataSourceDescription; switch (dataSourceType) { case DataSourceType.asset: dataSourceDescription = DataSource( @@ -276,11 +286,12 @@ class VideoPlayerController extends ValueNotifier { if (videoPlayerOptions?.mixWithOthers != null) { await _videoPlayerPlatform - .setMixWithOthers(videoPlayerOptions.mixWithOthers); + .setMixWithOthers(videoPlayerOptions!.mixWithOthers); } - _textureId = await _videoPlayerPlatform.create(dataSourceDescription); - _creatingCompleter.complete(null); + _textureId = (await _videoPlayerPlatform.create(dataSourceDescription)) ?? + kUninitializedTextureId; + _creatingCompleter!.complete(null); final Completer initializingCompleter = Completer(); void eventListener(VideoEvent event) { @@ -293,6 +304,7 @@ class VideoPlayerController extends ValueNotifier { value = value.copyWith( duration: event.duration, size: event.size, + isInitialized: event.duration != null, ); initializingCompleter.complete(null); _applyLooping(); @@ -325,8 +337,8 @@ class VideoPlayerController extends ValueNotifier { } void errorListener(Object obj) { - final PlatformException e = obj; - value = VideoPlayerValue.erroneous(e.message); + final PlatformException e = obj as PlatformException; + value = VideoPlayerValue.erroneous(e.message!); _timer?.cancel(); if (!initializingCompleter.isCompleted) { initializingCompleter.completeError(obj); @@ -342,7 +354,7 @@ class VideoPlayerController extends ValueNotifier { @override Future dispose() async { if (_creatingCompleter != null) { - await _creatingCompleter.future; + await _creatingCompleter!.future; if (!_isDisposed) { _isDisposed = true; _timer?.cancel(); @@ -379,14 +391,14 @@ class VideoPlayerController extends ValueNotifier { } Future _applyLooping() async { - if (!value.initialized || _isDisposed) { + if (!value.isInitialized || _isDisposed) { return; } await _videoPlayerPlatform.setLooping(_textureId, value.isLooping); } Future _applyPlayPause() async { - if (!value.initialized || _isDisposed) { + if (!value.isInitialized || _isDisposed) { return; } if (value.isPlaying) { @@ -400,8 +412,8 @@ class VideoPlayerController extends ValueNotifier { if (_isDisposed) { return; } - final Duration newPosition = await position; - if (_isDisposed) { + final Duration? newPosition = await position; + if (newPosition == null) { return; } _updatePosition(newPosition); @@ -419,14 +431,14 @@ class VideoPlayerController extends ValueNotifier { } Future _applyVolume() async { - if (!value.initialized || _isDisposed) { + if (!value.isInitialized || _isDisposed) { return; } await _videoPlayerPlatform.setVolume(_textureId, value.volume); } Future _applyPlaybackSpeed() async { - if (!value.initialized || _isDisposed) { + if (!value.isInitialized || _isDisposed) { return; } @@ -442,7 +454,7 @@ class VideoPlayerController extends ValueNotifier { } /// The position in the current video. - Future get position async { + Future get position async { if (_isDisposed) { return null; } @@ -519,17 +531,17 @@ class VideoPlayerController extends ValueNotifier { /// [Caption]. Caption _getCaptionAt(Duration position) { if (_closedCaptionFile == null) { - return Caption(); + return Caption.none; } // TODO: This would be more efficient as a binary search. - for (final caption in _closedCaptionFile.captions) { + for (final caption in _closedCaptionFile!.captions) { if (caption.start <= position && caption.end >= position) { return caption; } } - return Caption(); + return Caption.none; } void _updatePosition(Duration position) { @@ -545,7 +557,7 @@ class _VideoAppLifeCycleObserver extends Object with WidgetsBindingObserver { final VideoPlayerController _controller; void initialize() { - WidgetsBinding.instance.addObserver(this); + WidgetsBinding.instance!.addObserver(this); } @override @@ -565,7 +577,7 @@ class _VideoAppLifeCycleObserver extends Object with WidgetsBindingObserver { } void dispose() { - WidgetsBinding.instance.removeObserver(this); + WidgetsBinding.instance!.removeObserver(this); } } @@ -594,8 +606,9 @@ class _VideoPlayerState extends State { }; } - VoidCallback _listener; - int _textureId; + late VoidCallback _listener; + + late int _textureId; @override void initState() { @@ -622,7 +635,7 @@ class _VideoPlayerState extends State { @override Widget build(BuildContext context) { - return _textureId == null + return _textureId == VideoPlayerController.kUninitializedTextureId ? Container() : _videoPlayerPlatform.buildView(_textureId); } @@ -646,7 +659,7 @@ class VideoProgressColors { /// [backgroundColor] defaults to gray at 50% opacity. This is the background /// color behind both [playedColor] and [bufferedColor] to denote the total /// size of the video compared to either of those values. - VideoProgressColors({ + const VideoProgressColors({ this.playedColor = const Color.fromRGBO(255, 0, 0, 0.7), this.bufferedColor = const Color.fromRGBO(50, 50, 200, 0.2), this.backgroundColor = const Color.fromRGBO(200, 200, 200, 0.5), @@ -670,8 +683,8 @@ class VideoProgressColors { class _VideoScrubber extends StatefulWidget { _VideoScrubber({ - @required this.child, - @required this.controller, + required this.child, + required this.controller, }); final Widget child; @@ -689,7 +702,7 @@ class _VideoScrubberState extends State<_VideoScrubber> { @override Widget build(BuildContext context) { void seekToRelativePosition(Offset globalPosition) { - final RenderBox box = context.findRenderObject(); + final RenderBox box = context.findRenderObject() as RenderBox; final Offset tapPos = box.globalToLocal(globalPosition); final double relative = tapPos.dx / box.size.width; final Duration position = controller.value.duration * relative; @@ -700,7 +713,7 @@ class _VideoScrubberState extends State<_VideoScrubber> { behavior: HitTestBehavior.opaque, child: widget.child, onHorizontalDragStart: (DragStartDetails details) { - if (!controller.value.initialized) { + if (!controller.value.isInitialized) { return; } _controllerWasPlaying = controller.value.isPlaying; @@ -709,7 +722,7 @@ class _VideoScrubberState extends State<_VideoScrubber> { } }, onHorizontalDragUpdate: (DragUpdateDetails details) { - if (!controller.value.initialized) { + if (!controller.value.isInitialized) { return; } seekToRelativePosition(details.globalPosition); @@ -720,7 +733,7 @@ class _VideoScrubberState extends State<_VideoScrubber> { } }, onTapDown: (TapDownDetails details) { - if (!controller.value.initialized) { + if (!controller.value.isInitialized) { return; } seekToRelativePosition(details.globalPosition); @@ -745,10 +758,10 @@ class VideoProgressIndicator extends StatefulWidget { /// to `top: 5.0`. VideoProgressIndicator( this.controller, { - VideoProgressColors colors, - this.allowScrubbing, + this.colors = const VideoProgressColors(), + required this.allowScrubbing, this.padding = const EdgeInsets.only(top: 5.0), - }) : colors = colors ?? VideoProgressColors(); + }); /// The [VideoPlayerController] that actually associates a video with this /// widget. @@ -785,7 +798,7 @@ class _VideoProgressIndicatorState extends State { }; } - VoidCallback listener; + late VoidCallback listener; VideoPlayerController get controller => widget.controller; @@ -806,7 +819,7 @@ class _VideoProgressIndicatorState extends State { @override Widget build(BuildContext context) { Widget progressIndicator; - if (controller.value.initialized) { + if (controller.value.isInitialized) { final int duration = controller.value.duration.inMilliseconds; final int position = controller.value.position.inMilliseconds; @@ -878,17 +891,17 @@ class ClosedCaption extends StatelessWidget { /// [VideoPlayerValue.caption]. /// /// If [text] is null, nothing will be displayed. - const ClosedCaption({Key key, this.text, this.textStyle}) : super(key: key); + const ClosedCaption({Key? key, this.text, this.textStyle}) : super(key: key); /// The text that will be shown in the closed caption, or null if no caption /// should be shown. - final String text; + final String? text; /// Specifies how the text in the closed caption should look. /// /// If null, defaults to [DefaultTextStyle.of(context).style] with size 36 /// font colored white. - final TextStyle textStyle; + final TextStyle? textStyle; @override Widget build(BuildContext context) { @@ -913,7 +926,7 @@ class ClosedCaption extends StatelessWidget { ), child: Padding( padding: EdgeInsets.symmetric(horizontal: 2.0), - child: Text(text, style: effectiveTextStyle), + child: Text(text!, style: effectiveTextStyle), ), ), ), diff --git a/packages/video_player/video_player/pigeons/messages.dart b/packages/video_player/video_player/pigeons/messages.dart index 427aea279071..f1771afecb45 100644 --- a/packages/video_player/video_player/pigeons/messages.dart +++ b/packages/video_player/video_player/pigeons/messages.dart @@ -1,3 +1,5 @@ +// @dart = 2.9 + import 'package:pigeon/pigeon_lib.dart'; class TextureMessage { diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index 96ced42cedcf..36d5758ac15e 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -4,9 +4,12 @@ description: Flutter plugin for displaying inline video with other Flutter # 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.11.1+2 +version: 0.12.0 homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none + flutter: plugin: platforms: @@ -19,15 +22,21 @@ flutter: default_package: video_player_web dependencies: - meta: ^1.0.5 - video_player_platform_interface: ^2.2.0 + meta: ^1.3.0-nullsafety.3 + video_player_platform_interface: + path: ../video_player_platform_interface + # git: + # url: https://github.com/flutter/plugins.git + # ref: nnbd + # path: packages/video_player/video_player_platform_interface # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish # validation, so we set a ^ constraint. # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - video_player_web: '>=0.1.4 <2.0.0' + video_player_web: + path: ../video_player_web flutter: sdk: flutter @@ -35,9 +44,9 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 pigeon: 0.1.7 environment: - sdk: ">=2.8.0 <3.0.0" + sdk: '>=2.10.0-56.0.dev <3.0.0' flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/video_player/video_player/test/sub_rip_file_test.dart b/packages/video_player/video_player/test/sub_rip_file_test.dart index cf25ff73e438..2b9803d8275e 100644 --- a/packages/video_player/video_player/test/sub_rip_file_test.dart +++ b/packages/video_player/video_player/test/sub_rip_file_test.dart @@ -108,6 +108,6 @@ This one is valid 3 00:01:54,724 --> 00:01:6,760 -This one should be ignored because the +This one should be ignored because the ned time is missing a digit. '''; diff --git a/packages/video_player/video_player/test/video_player_initialization_test.dart b/packages/video_player/video_player/test/video_player_initialization_test.dart index 231c399bb8fe..1a09ed9f718c 100644 --- a/packages/video_player/video_player/test/video_player_initialization_test.dart +++ b/packages/video_player/video_player/test/video_player_initialization_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 - import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:video_player/video_player.dart'; diff --git a/packages/video_player/video_player/test/video_player_test.dart b/packages/video_player/video_player/test/video_player_test.dart index a40781a1e9ce..4cb559b00c02 100644 --- a/packages/video_player/video_player/test/video_player_test.dart +++ b/packages/video_player/video_player/test/video_player_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 - import 'dart:async'; import 'dart:io'; @@ -18,7 +16,7 @@ import 'package:video_player_platform_interface/video_player_platform_interface. class FakeController extends ValueNotifier implements VideoPlayerController { - FakeController() : super(VideoPlayerValue(duration: null)); + FakeController() : super(VideoPlayerValue(duration: Duration.zero)); @override Future dispose() async { @@ -26,7 +24,7 @@ class FakeController extends ValueNotifier } @override - int textureId; + int textureId = VideoPlayerController.kUninitializedTextureId; @override String get dataSource => ''; @@ -35,7 +33,7 @@ class FakeController extends ValueNotifier DataSourceType get dataSourceType => DataSourceType.file; @override - String get package => null; + String get package => null!; @override Future get position async => value.position; @@ -62,13 +60,13 @@ class FakeController extends ValueNotifier Future setLooping(bool looping) async {} @override - VideoFormat get formatHint => null; + VideoFormat? get formatHint => null; @override Future get closedCaptionFile => _loadClosedCaption(); @override - VideoPlayerOptions get videoPlayerOptions => null; + VideoPlayerOptions? get videoPlayerOptions => null; } Future _loadClosedCaption() async => @@ -80,11 +78,13 @@ class _FakeClosedCaptionFile extends ClosedCaptionFile { return [ Caption( text: 'one', + number: 0, start: Duration(milliseconds: 100), end: Duration(milliseconds: 200), ), Caption( text: 'two', + number: 1, start: Duration(milliseconds: 300), end: Duration(milliseconds: 400), ), @@ -101,6 +101,7 @@ void main() { controller.textureId = 123; controller.value = controller.value.copyWith( duration: const Duration(milliseconds: 100), + isInitialized: true, ); await tester.pump(); @@ -133,8 +134,8 @@ void main() { await tester.pumpWidget(MaterialApp(home: ClosedCaption(text: text))); final Text textWidget = tester.widget(find.text(text)); - expect(textWidget.style.fontSize, 36.0); - expect(textWidget.style.color, Colors.white); + expect(textWidget.style!.fontSize, 36.0); + expect(textWidget.style!.color, Colors.white); }); testWidgets('uses given text and style', (WidgetTester tester) async { @@ -149,7 +150,7 @@ void main() { expect(find.text(text), findsOneWidget); final Text textWidget = tester.widget(find.text(text)); - expect(textWidget.style.fontSize, textStyle.fontSize); + expect(textWidget.style!.fontSize, textStyle.fontSize); }); testWidgets('handles null text', (WidgetTester tester) async { @@ -173,7 +174,7 @@ void main() { }); group('VideoPlayerController', () { - FakeVideoPlayerPlatform fakeVideoPlayerPlatform; + late FakeVideoPlayerPlatform fakeVideoPlayerPlatform; setUp(() { fakeVideoPlayerPlatform = FakeVideoPlayerPlatform(); @@ -221,7 +222,7 @@ void main() { 'http://testing.com/invalid_url', ); try { - dynamic error; + late dynamic error; fakeVideoPlayerPlatform.forceInitError = true; await controller.initialize().catchError((dynamic e) => error = e); final PlatformException platformEx = error; @@ -245,13 +246,14 @@ void main() { final VideoPlayerController controller = VideoPlayerController.network( 'https://127.0.0.1', ); - expect(controller.textureId, isNull); + expect( + controller.textureId, VideoPlayerController.kUninitializedTextureId); expect(await controller.position, const Duration(seconds: 0)); await controller.initialize(); await controller.dispose(); - expect(controller.textureId, isNotNull); + expect(controller.textureId, 0); expect(await controller.position, isNull); }); @@ -390,19 +392,19 @@ void main() { await controller.initialize(); expect(controller.value.position, const Duration()); - expect(controller.value.caption.text, isNull); + expect(controller.value.caption.text, ''); await controller.seekTo(const Duration(milliseconds: 100)); expect(controller.value.caption.text, 'one'); await controller.seekTo(const Duration(milliseconds: 250)); - expect(controller.value.caption.text, isNull); + expect(controller.value.caption.text, ''); await controller.seekTo(const Duration(milliseconds: 300)); expect(controller.value.caption.text, 'two'); await controller.seekTo(const Duration(milliseconds: 500)); - expect(controller.value.caption.text, isNull); + expect(controller.value.caption.text, ''); await controller.seekTo(const Duration(milliseconds: 300)); expect(controller.value.caption.text, 'two'); @@ -419,8 +421,7 @@ void main() { await controller.play(); expect(controller.value.isPlaying, isTrue); final FakeVideoEventStream fakeVideoEventStream = - fakeVideoPlayerPlatform.streams[controller.textureId]; - assert(fakeVideoEventStream != null); + fakeVideoPlayerPlatform.streams[controller.textureId]!; fakeVideoEventStream.eventsChannel .sendEvent({'event': 'completed'}); @@ -438,8 +439,7 @@ void main() { expect(controller.value.isBuffering, false); expect(controller.value.buffered, isEmpty); final FakeVideoEventStream fakeVideoEventStream = - fakeVideoPlayerPlatform.streams[controller.textureId]; - assert(fakeVideoEventStream != null); + fakeVideoPlayerPlatform.streams[controller.textureId]!; fakeVideoEventStream.eventsChannel .sendEvent({'event': 'bufferingStart'}); @@ -496,9 +496,9 @@ void main() { test('uninitialized()', () { final VideoPlayerValue uninitialized = VideoPlayerValue.uninitialized(); - expect(uninitialized.duration, isNull); - expect(uninitialized.position, equals(const Duration(seconds: 0))); - expect(uninitialized.caption, equals(const Caption())); + expect(uninitialized.duration, equals(Duration.zero)); + expect(uninitialized.position, equals(Duration.zero)); + expect(uninitialized.caption, equals(Caption.none)); expect(uninitialized.buffered, isEmpty); expect(uninitialized.isPlaying, isFalse); expect(uninitialized.isLooping, isFalse); @@ -506,20 +506,19 @@ void main() { expect(uninitialized.volume, 1.0); expect(uninitialized.playbackSpeed, 1.0); expect(uninitialized.errorDescription, isNull); - expect(uninitialized.size, isNull); - expect(uninitialized.size, isNull); - expect(uninitialized.initialized, isFalse); + expect(uninitialized.size, equals(Size.zero)); + expect(uninitialized.isInitialized, isFalse); expect(uninitialized.hasError, isFalse); - expect(uninitialized.aspectRatio, 1.0); + expect(uninitialized.aspectRatio, 0.0); }); test('erroneous()', () { const String errorMessage = 'foo'; final VideoPlayerValue error = VideoPlayerValue.erroneous(errorMessage); - expect(error.duration, isNull); - expect(error.position, equals(const Duration(seconds: 0))); - expect(error.caption, equals(const Caption())); + expect(error.duration, equals(Duration.zero)); + expect(error.position, equals(Duration.zero)); + expect(error.caption, equals(Caption.none)); expect(error.buffered, isEmpty); expect(error.isPlaying, isFalse); expect(error.isLooping, isFalse); @@ -527,18 +526,18 @@ void main() { expect(error.volume, 1.0); expect(error.playbackSpeed, 1.0); expect(error.errorDescription, errorMessage); - expect(error.size, isNull); - expect(error.size, isNull); - expect(error.initialized, isFalse); + expect(error.size, equals(Size.zero)); + expect(error.isInitialized, isFalse); expect(error.hasError, isTrue); - expect(error.aspectRatio, 1.0); + expect(error.aspectRatio, 0.0); }); test('toString()', () { const Duration duration = Duration(seconds: 5); const Size size = Size(400, 300); const Duration position = Duration(seconds: 1); - const Caption caption = Caption(text: 'foo'); + const Caption caption = Caption( + text: 'foo', number: 0, start: Duration.zero, end: Duration.zero); final List buffered = [ DurationRange(const Duration(seconds: 0), const Duration(seconds: 4)) ]; @@ -568,6 +567,7 @@ void main() { 'position: 0:00:01.000000, ' 'caption: Instance of \'Caption\', ' 'buffered: [DurationRange(start: 0:00:00.000000, end: 0:00:04.000000)], ' + 'isInitialized: true, ' 'isPlaying: true, ' 'isLooping: true, ' 'isBuffering: true, ' @@ -586,15 +586,16 @@ void main() { group('aspectRatio', () { test('640x480 -> 4:3', () { final value = VideoPlayerValue( + isInitialized: true, size: Size(640, 480), duration: Duration(seconds: 1), ); expect(value.aspectRatio, 4 / 3); }); - test('null size -> 1.0', () { + test('no size -> 1.0', () { final value = VideoPlayerValue( - size: null, + isInitialized: true, duration: Duration(seconds: 1), ); expect(value.aspectRatio, 1.0); @@ -602,6 +603,7 @@ void main() { test('height = 0 -> 1.0', () { final value = VideoPlayerValue( + isInitialized: true, size: Size(640, 0), duration: Duration(seconds: 1), ); @@ -610,6 +612,7 @@ void main() { test('width = 0 -> 1.0', () { final value = VideoPlayerValue( + isInitialized: true, size: Size(0, 480), duration: Duration(seconds: 1), ); @@ -618,6 +621,7 @@ void main() { test('negative aspect ratio -> 1.0', () { final value = VideoPlayerValue( + isInitialized: true, size: Size(640, -480), duration: Duration(seconds: 1), ); @@ -646,7 +650,7 @@ void main() { File(''), videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true)); await controller.initialize(); - expect(controller.videoPlayerOptions.mixWithOthers, true); + expect(controller.videoPlayerOptions!.mixWithOthers, true); }); } @@ -706,7 +710,7 @@ class FakeVideoPlayerPlatform extends TestHostVideoPlayerApi { @override void seekTo(PositionMessage arg) { calls.add('seekTo'); - _positions[arg.textureId] = Duration(milliseconds: arg.position); + _positions[arg.textureId!] = Duration(milliseconds: arg.position!); } @override @@ -742,7 +746,7 @@ class FakeVideoEventStream { int height; Duration duration; bool initWithError; - FakeEventsChannel eventsChannel; + late FakeEventsChannel eventsChannel; void onListen() { if (!initWithError) { @@ -764,7 +768,7 @@ class FakeEventsChannel { eventsMethodChannel.setMockMethodCallHandler(onMethodCall); } - MethodChannel eventsMethodChannel; + late MethodChannel eventsMethodChannel; VoidCallback onListen; Future onMethodCall(MethodCall call) { @@ -780,7 +784,7 @@ class FakeEventsChannel { _sendMessage(const StandardMethodCodec().encodeSuccessEnvelope(event)); } - void sendError(String code, [String message, dynamic details]) { + void sendError(String code, [String? message, dynamic details]) { _sendMessage(const StandardMethodCodec().encodeErrorEnvelope( code: code, message: message, @@ -794,6 +798,6 @@ class FakeEventsChannel { // available on all the versions of Flutter that we test. // ignore: deprecated_member_use defaultBinaryMessenger.handlePlatformMessage( - eventsMethodChannel.name, data, (ByteData data) {}); + eventsMethodChannel.name, data, (ByteData? data) {}); } } diff --git a/packages/video_player/video_player_platform_interface/CHANGELOG.md b/packages/video_player/video_player_platform_interface/CHANGELOG.md index 5ecbb739e67c..1522d2be478b 100644 --- a/packages/video_player/video_player_platform_interface/CHANGELOG.md +++ b/packages/video_player/video_player_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.0-nullsafety.1 + +* Make DataSource's `uri` parameter nullable. + ## 3.0.0-nullsafety * Migrate to null safety. diff --git a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart index 7b472dc8d442..f2bc00205acc 100644 --- a/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart +++ b/packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart @@ -147,7 +147,7 @@ class DataSource { /// package and null otherwise. DataSource({ required this.sourceType, - required this.uri, + this.uri, this.formatHint, this.asset, this.package, @@ -163,7 +163,7 @@ class DataSource { /// /// This will be in different formats depending on the [DataSourceType] of /// the original video. - final String uri; + final String? uri; /// **Android only**. Will override the platform's generic file format /// detection with whatever is set here. diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml index d86a3b9132e3..e9850a6ddc79 100644 --- a/packages/video_player/video_player_platform_interface/pubspec.yaml +++ b/packages/video_player/video_player_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the video_player plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_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: 3.0.0-nullsafety +version: 3.0.0-nullsafety.1 dependencies: flutter: diff --git a/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart b/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart index 4db58770c629..5c19ebca0d12 100644 --- a/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart +++ b/packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart @@ -145,7 +145,6 @@ void main() { test('create with asset', () async { final int textureId = await player.create(DataSource( sourceType: DataSourceType.asset, - uri: 'someUri', asset: 'someAsset', package: 'somePackage', )); diff --git a/packages/video_player/video_player_web/CHANGELOG.md b/packages/video_player/video_player_web/CHANGELOG.md index d18504913d89..732f7878ddb0 100644 --- a/packages/video_player/video_player_web/CHANGELOG.md +++ b/packages/video_player/video_player_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0 + +* Migrate to null safety. + ## 0.1.4 * Added option to set the video playback speed on the video controller. diff --git a/packages/video_player/video_player_web/analysis_options.yaml b/packages/video_player/video_player_web/analysis_options.yaml index 443b16551ec9..7e5b7b306a83 100644 --- a/packages/video_player/video_player_web/analysis_options.yaml +++ b/packages/video_player/video_player_web/analysis_options.yaml @@ -6,5 +6,7 @@ include: ../../../analysis_options.yaml analyzer: + enable-experiment: + - non-nullable errors: undefined_prefixed_name: ignore diff --git a/packages/video_player/video_player_web/lib/video_player_web.dart b/packages/video_player/video_player_web/lib/video_player_web.dart index 251da3779e7f..7c9c338e3cd8 100644 --- a/packages/video_player/video_player_web/lib/video_player_web.dart +++ b/packages/video_player/video_player_web/lib/video_player_web.dart @@ -50,7 +50,7 @@ class VideoPlayerPlugin extends VideoPlayerPlatform { @override Future dispose(int textureId) async { - _videoPlayers[textureId].dispose(); + _videoPlayers[textureId]!.dispose(); _videoPlayers.remove(textureId); return null; } @@ -66,16 +66,16 @@ class VideoPlayerPlugin extends VideoPlayerPlatform { final int textureId = _textureCounter; _textureCounter++; - String uri; + late String uri; switch (dataSource.sourceType) { case DataSourceType.network: // Do NOT modify the incoming uri, it can be a Blob, and Safari doesn't // like blobs that have changed. - uri = dataSource.uri; + uri = dataSource.uri ?? ''; break; case DataSourceType.asset: - String assetUrl = dataSource.asset; - if (dataSource.package != null && dataSource.package.isNotEmpty) { + String assetUrl = dataSource.asset!; + if (dataSource.package != null && dataSource.package!.isNotEmpty) { assetUrl = 'packages/${dataSource.package}/$assetUrl'; } // 'webOnlyAssetManager' is only in the web version of dart:ui @@ -101,45 +101,45 @@ class VideoPlayerPlugin extends VideoPlayerPlatform { @override Future setLooping(int textureId, bool looping) async { - return _videoPlayers[textureId].setLooping(looping); + return _videoPlayers[textureId]!.setLooping(looping); } @override Future play(int textureId) async { - return _videoPlayers[textureId].play(); + return _videoPlayers[textureId]!.play(); } @override Future pause(int textureId) async { - return _videoPlayers[textureId].pause(); + return _videoPlayers[textureId]!.pause(); } @override Future setVolume(int textureId, double volume) async { - return _videoPlayers[textureId].setVolume(volume); + return _videoPlayers[textureId]!.setVolume(volume); } @override Future setPlaybackSpeed(int textureId, double speed) async { assert(speed > 0); - return _videoPlayers[textureId].setPlaybackSpeed(speed); + return _videoPlayers[textureId]!.setPlaybackSpeed(speed); } @override Future seekTo(int textureId, Duration position) async { - return _videoPlayers[textureId].seekTo(position); + return _videoPlayers[textureId]!.seekTo(position); } @override Future getPosition(int textureId) async { - _videoPlayers[textureId].sendBufferingUpdate(); - return _videoPlayers[textureId].getPosition(); + _videoPlayers[textureId]!.sendBufferingUpdate(); + return _videoPlayers[textureId]!.getPosition(); } @override Stream videoEventsFor(int textureId) { - return _videoPlayers[textureId].eventController.stream; + return _videoPlayers[textureId]!.eventController.stream; } @override @@ -149,14 +149,14 @@ class VideoPlayerPlugin extends VideoPlayerPlatform { } class _VideoPlayer { - _VideoPlayer({this.uri, this.textureId}); + _VideoPlayer({required this.uri, required this.textureId}); final StreamController eventController = StreamController(); final String uri; final int textureId; - VideoElement videoElement; + late VideoElement videoElement; bool isInitialized = false; void initialize() { @@ -186,9 +186,9 @@ class _VideoPlayer { // The Event itself (_) doesn't contain info about the actual error. // We need to look at the HTMLMediaElement.error. // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/error - MediaError error = videoElement.error; + MediaError error = videoElement.error!; eventController.addError(PlatformException( - code: _kErrorValueToErrorName[error.code], + code: _kErrorValueToErrorName[error.code]!, message: error.message != '' ? error.message : _kDefaultErrorMessage, details: _kErrorValueToErrorDescription[error.code], )); @@ -261,8 +261,8 @@ class _VideoPlayer { milliseconds: (videoElement.duration * 1000).round(), ), size: Size( - videoElement.videoWidth.toDouble() ?? 0.0, - videoElement.videoHeight.toDouble() ?? 0.0, + videoElement.videoWidth.toDouble(), + videoElement.videoHeight.toDouble(), ), ), ); diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index 98191bf6ba85..e566946489d9 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -4,7 +4,10 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/v # 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.1.4 +version: 0.2.0 + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none flutter: plugin: @@ -18,16 +21,21 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter - meta: ^1.1.7 - video_player_platform_interface: ^2.2.0 + meta: ^1.3.0-nullsafety.3 + video_player_platform_interface: + path: ../video_player_platform_interface + # git: + # url: https://github.com/flutter/plugins.git + # ref: nnbd + # path: packages/video_player/video_player_platform_interface dev_dependencies: flutter_test: sdk: flutter video_player: path: ../video_player - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 environment: - sdk: ">=2.8.0 <3.0.0" - flutter: ">=1.12.8 <2.0.0" + sdk: '>=2.10.0-56.0.dev <3.0.0' + flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/video_player/video_player_web/test/video_player_web_test.dart b/packages/video_player/video_player_web/test/video_player_web_test.dart index 453079bfcd40..c433d82027f0 100644 --- a/packages/video_player/video_player_web/test/video_player_web_test.dart +++ b/packages/video_player/video_player_web/test/video_player_web_test.dart @@ -14,16 +14,16 @@ import 'package:video_player_web/video_player_web.dart'; void main() { group('VideoPlayer for Web', () { - int textureId; + late int textureId; setUp(() async { VideoPlayerPlatform.instance = VideoPlayerPlugin(); - textureId = await VideoPlayerPlatform.instance.create( + textureId = (await VideoPlayerPlatform.instance.create( DataSource( sourceType: DataSourceType.network, uri: 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4'), - ); + ))!; }); test('$VideoPlayerPlugin is the live instance', () { @@ -84,12 +84,12 @@ void main() { }); test('throws PlatformException when playing bad media', () async { - int videoPlayerId = await VideoPlayerPlatform.instance.create( + int videoPlayerId = (await VideoPlayerPlatform.instance.create( DataSource( sourceType: DataSourceType.network, uri: 'https://flutter.github.io/assets-for-api-docs/assets/videos/_non_existent_video.mp4'), - ); + ))!; Stream eventStream = VideoPlayerPlatform.instance.videoEventsFor(videoPlayerId); diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 3690b569bec0..15a969070950 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -23,6 +23,7 @@ CUSTOM_ANALYSIS_PLUGINS=( "in_app_purchase" "camera" "plugin_platform_interface" + "video_player/video_player" "video_player/video_player_platform_interface" "video_player/video_player_web" "google_maps_flutter/google_maps_flutter_web" From 052ec5fb6b223adb2f4087f9c913dc1d32b5b591 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Wed, 21 Oct 2020 02:05:01 +0200 Subject: [PATCH 09/58] [url_launcher] migrate url_launcher package to null safety (#3148) --- .../url_launcher/url_launcher/CHANGELOG.md | 4 ++ .../url_launcher/analysis_options.yaml | 4 ++ .../url_launcher/example/lib/main.dart | 4 +- .../url_launcher/example/pubspec.yaml | 9 +++- .../url_launcher/lib/url_launcher.dart | 47 +++++++++---------- .../url_launcher/url_launcher/pubspec.yaml | 27 +++++++---- .../url_launcher/test/url_launcher_test.dart | 7 ++- .../pubspec.yaml | 2 +- .../url_launcher_web/analysis_options.yaml | 4 ++ .../url_launcher_web/pubspec.yaml | 8 +++- .../url_launcher_web/test/pubspec.yaml | 2 +- script/incremental_build.sh | 1 + 12 files changed, 74 insertions(+), 45 deletions(-) create mode 100644 packages/url_launcher/url_launcher/analysis_options.yaml create mode 100644 packages/url_launcher/url_launcher_web/analysis_options.yaml diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index 8a15a2b9a6b1..998c0d243206 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.0.0-nullsafety + +* Migrate to null safety. + ## 5.7.4 * Update android compileSdkVersion to 29. diff --git a/packages/url_launcher/url_launcher/analysis_options.yaml b/packages/url_launcher/url_launcher/analysis_options.yaml new file mode 100644 index 000000000000..3d64bb57fe49 --- /dev/null +++ b/packages/url_launcher/url_launcher/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable diff --git a/packages/url_launcher/url_launcher/example/lib/main.dart b/packages/url_launcher/url_launcher/example/lib/main.dart index f7d90c4bef65..f493e6121401 100644 --- a/packages/url_launcher/url_launcher/example/lib/main.dart +++ b/packages/url_launcher/url_launcher/example/lib/main.dart @@ -27,7 +27,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; @override @@ -35,7 +35,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - Future _launched; + late Future _launched; String _phone = ''; Future _launchInBrowser(String url) async { diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index b48445c3a7e9..7e464dec6fe3 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -12,9 +12,14 @@ dev_dependencies: path: ../../../integration_test flutter_driver: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - plugin_platform_interface: ^1.0.0 + # TODO (mvanbeusekom): Update to use pub.dev once 1.10.0-nullsafety released. + plugin_platform_interface: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/plugin_platform_interface flutter: uses-material-design: true diff --git a/packages/url_launcher/url_launcher/lib/url_launcher.dart b/packages/url_launcher/url_launcher/lib/url_launcher.dart index ccc6833f0941..27bb6aba2226 100644 --- a/packages/url_launcher/url_launcher/lib/url_launcher.dart +++ b/packages/url_launcher/url_launcher/lib/url_launcher.dart @@ -59,16 +59,15 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface. /// is set to true and the universal link failed to launch. Future launch( String urlString, { - bool forceSafariVC, - bool forceWebView, - bool enableJavaScript, - bool enableDomStorage, - bool universalLinksOnly, - Map headers, - Brightness statusBarBrightness, - String webOnlyWindowName, + bool forceSafariVC = true, + bool forceWebView = false, + bool enableJavaScript = false, + bool enableDomStorage = false, + bool universalLinksOnly = false, + Map headers = const {}, + Brightness? statusBarBrightness, + String? webOnlyWindowName, }) async { - assert(urlString != null); final Uri url = Uri.parse(urlString.trimLeft()); final bool isWebURL = url.scheme == 'http' || url.scheme == 'https'; if ((forceSafariVC == true || forceWebView == true) && !isWebURL) { @@ -81,29 +80,32 @@ Future launch( /// [true] so that ui is automatically computed if [statusBarBrightness] is set. bool previousAutomaticSystemUiAdjustment = true; if (statusBarBrightness != null && - defaultTargetPlatform == TargetPlatform.iOS) { + defaultTargetPlatform == TargetPlatform.iOS && + WidgetsBinding.instance != null) { previousAutomaticSystemUiAdjustment = - WidgetsBinding.instance.renderView.automaticSystemUiAdjustment; - WidgetsBinding.instance.renderView.automaticSystemUiAdjustment = false; + WidgetsBinding.instance!.renderView.automaticSystemUiAdjustment; + WidgetsBinding.instance!.renderView.automaticSystemUiAdjustment = false; SystemChrome.setSystemUIOverlayStyle(statusBarBrightness == Brightness.light ? SystemUiOverlayStyle.dark : SystemUiOverlayStyle.light); } + final bool result = await UrlLauncherPlatform.instance.launch( urlString, - useSafariVC: forceSafariVC ?? isWebURL, - useWebView: forceWebView ?? false, - enableJavaScript: enableJavaScript ?? false, - enableDomStorage: enableDomStorage ?? false, - universalLinksOnly: universalLinksOnly ?? false, - headers: headers ?? {}, + useSafariVC: forceSafariVC, + useWebView: forceWebView, + enableJavaScript: enableJavaScript, + enableDomStorage: enableDomStorage, + universalLinksOnly: universalLinksOnly, + headers: headers, webOnlyWindowName: webOnlyWindowName, ); - assert(previousAutomaticSystemUiAdjustment != null); - if (statusBarBrightness != null) { - WidgetsBinding.instance.renderView.automaticSystemUiAdjustment = + + if (statusBarBrightness != null && WidgetsBinding.instance != null) { + WidgetsBinding.instance!.renderView.automaticSystemUiAdjustment = previousAutomaticSystemUiAdjustment; } + return result; } @@ -115,9 +117,6 @@ Future launch( /// For more information see the [Managing package visibility](https://developer.android.com/training/basics/intents/package-visibility) /// article in the Android docs. Future canLaunch(String urlString) async { - if (urlString == null) { - return false; - } return await UrlLauncherPlatform.instance.canLaunch(urlString); } diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 49d52eecf69d..43688ff6954b 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher description: Flutter plugin for launching a URL on Android and iOS. Supports web, phone, SMS, and email schemes. homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher -version: 5.7.4 +version: 6.0.0-nullsafety flutter: plugin: @@ -12,8 +12,9 @@ flutter: pluginClass: UrlLauncherPlugin ios: pluginClass: FLTURLLauncherPlugin - web: - default_package: url_launcher_web + # TODO(mvanbeusekom): Temporary disabled until web is migrated to nnbd (advised by @blasten). + #web: + # default_package: url_launcher_web linux: default_package: url_laucher_linux macos: @@ -24,25 +25,33 @@ flutter: dependencies: flutter: sdk: flutter - url_launcher_platform_interface: ^1.0.8 + # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. + url_launcher_platform_interface: + path: ../url_launcher_platform_interface # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish # validation, so we set a ^ constraint. # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - url_launcher_web: ^0.1.3 url_launcher_linux: ^0.0.1 url_launcher_macos: ^0.0.1 url_launcher_windows: ^0.0.1 + # TODO(mvanbeusekom): Temporary disabled until web is migrated to nnbd (advised by @blasten). + #url_launcher_web: ^0.1.3 dev_dependencies: flutter_test: sdk: flutter - test: ^1.3.0 + test: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - plugin_platform_interface: ^1.0.0 - pedantic: ^1.8.0 + # TODO (mvanbeusekom): Update to use pub.dev once 1.10.0-nullsafety released. + plugin_platform_interface: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/plugin_platform_interface + pedantic: ^1.10.0-nullsafety.1 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" diff --git a/packages/url_launcher/url_launcher/test/url_launcher_test.dart b/packages/url_launcher/url_launcher/test/url_launcher_test.dart index f18e16c7e318..1934d8af2ad3 100644 --- a/packages/url_launcher/url_launcher/test/url_launcher_test.dart +++ b/packages/url_launcher/url_launcher/test/url_launcher_test.dart @@ -6,7 +6,10 @@ import 'dart:async'; import 'dart:ui'; + import 'package:flutter_test/flutter_test.dart'; +// TODO(mvanbeusekom): Remove once Mockito is migrated to null safety. +// @dart = 2.9 import 'package:mockito/mockito.dart'; import 'package:flutter/foundation.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; @@ -41,10 +44,6 @@ void main() { }); }); group('launch', () { - test('requires a non-null urlString', () { - expect(() => launch(null), throwsAssertionError); - }); - test('default behavior', () async { await launch('http://flutter.dev/'); expect( diff --git a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml index 823456854872..cbe2cf05e043 100644 --- a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml +++ b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml @@ -8,7 +8,7 @@ version: 2.0.0-nullsafety dependencies: flutter: sdk: flutter - # TODO (mvanbeusekom): use pub.dev once 1.10.0-nullsafety released. + # TODO (mvanbeusekom): Update to use pub.dev once 1.10.0-nullsafety released. plugin_platform_interface: git: url: https://github.com/flutter/plugins.git diff --git a/packages/url_launcher/url_launcher_web/analysis_options.yaml b/packages/url_launcher/url_launcher_web/analysis_options.yaml new file mode 100644 index 000000000000..3d64bb57fe49 --- /dev/null +++ b/packages/url_launcher/url_launcher_web/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable diff --git a/packages/url_launcher/url_launcher_web/pubspec.yaml b/packages/url_launcher/url_launcher_web/pubspec.yaml index 957b25757036..0fa5b35d4014 100644 --- a/packages/url_launcher/url_launcher_web/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/pubspec.yaml @@ -14,7 +14,9 @@ flutter: fileName: url_launcher_web.dart dependencies: - url_launcher_platform_interface: ^1.0.8 + # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. + url_launcher_platform_interface: + path: ../url_launcher_platform_interface flutter: sdk: flutter flutter_web_plugins: @@ -24,7 +26,9 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - url_launcher: ^5.2.5 + # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. + url_launcher: + path: ../url_launcher pedantic: ^1.8.0 mockito: ^4.1.1 integration_test: diff --git a/packages/url_launcher/url_launcher_web/test/pubspec.yaml b/packages/url_launcher/url_launcher_web/test/pubspec.yaml index e755dff85004..b8c541f72986 100644 --- a/packages/url_launcher/url_launcher_web/test/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/test/pubspec.yaml @@ -2,7 +2,7 @@ name: regular_integration_tests publish_to: none environment: - sdk: ">=2.2.2 <3.0.0" + sdk: ">=2.10.0-56.0.dev <3.0.0" dependencies: flutter: diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 15a969070950..f41f91d7906f 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -28,6 +28,7 @@ CUSTOM_ANALYSIS_PLUGINS=( "video_player/video_player_web" "google_maps_flutter/google_maps_flutter_web" "url_launcher/url_launcher_platform_interface" + "url_launcher/url_launcher" "device_info/device_info_platform_interface" "device_info/device_info" ) From 7bc1151d16898ab10492cf56310e28c02a89f4b9 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 21 Oct 2020 09:39:40 -0700 Subject: [PATCH 10/58] [nnbd] Various fixes (#3175) --- .../connectivity/test/connectivity_test.dart | 2 +- .../integration_test/device_info_test.dart | 1 + .../example/test_driver/integration_test.dart | 1 + .../test/method_channel_device_info_test.dart | 3 +-- .../test/google_sign_in_test.dart | 2 +- .../test/shared_preferences_test.dart | 2 +- .../integration_test/url_launcher_test.dart | 3 +++ .../url_launcher/example/lib/main.dart | 2 +- .../test/url_launcher_example_test.dart | 7 ++++++ .../example/test_driver/integration_test.dart | 3 +++ .../url_launcher/url_launcher/pubspec.yaml | 25 +++++++++++++++---- .../url_launcher/test/url_launcher_test.dart | 5 ++-- .../url_launcher_linux/CHANGELOG.md | 4 +++ .../url_launcher_linux/pubspec.yaml | 4 +-- .../url_launcher_macos/CHANGELOG.md | 4 +++ .../url_launcher_macos/pubspec.yaml | 4 +-- .../url_launcher_web/CHANGELOG.md | 2 +- .../url_launcher_web/analysis_options.yaml | 4 --- .../url_launcher_web/pubspec.yaml | 7 ++++-- .../url_launcher_windows/CHANGELOG.md | 4 +++ .../url_launcher_windows/pubspec.yaml | 4 +-- .../video_player/video_player/pubspec.yaml | 14 ++++++----- .../video_player_web/pubspec.yaml | 9 +++---- 23 files changed, 78 insertions(+), 38 deletions(-) delete mode 100644 packages/url_launcher/url_launcher_web/analysis_options.yaml diff --git a/packages/connectivity/connectivity/test/connectivity_test.dart b/packages/connectivity/connectivity/test/connectivity_test.dart index 7ed2c8d7f7e2..45eb995bb06c 100644 --- a/packages/connectivity/connectivity/test/connectivity_test.dart +++ b/packages/connectivity/connectivity/test/connectivity_test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 +// @dart = 2.9 import 'package:connectivity/connectivity.dart'; import 'package:connectivity_platform_interface/connectivity_platform_interface.dart'; diff --git a/packages/device_info/device_info/example/integration_test/device_info_test.dart b/packages/device_info/device_info/example/integration_test/device_info_test.dart index 33b745af13f9..61c4396b0d8e 100644 --- a/packages/device_info/device_info/example/integration_test/device_info_test.dart +++ b/packages/device_info/device_info/example/integration_test/device_info_test.dart @@ -4,6 +4,7 @@ // 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'; diff --git a/packages/device_info/device_info/example/test_driver/integration_test.dart b/packages/device_info/device_info/example/test_driver/integration_test.dart index bd3dc09c190c..13327bb884c9 100644 --- a/packages/device_info/device_info/example/test_driver/integration_test.dart +++ b/packages/device_info/device_info/example/test_driver/integration_test.dart @@ -4,6 +4,7 @@ // 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'; diff --git a/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart b/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart index dfc833da7e79..0a1ba7042a4a 100644 --- a/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart +++ b/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart @@ -4,11 +4,10 @@ // TODO(cyanglaz): Remove once https://github.com/flutter/flutter/issues/59879 is fixed. // @dart = 2.9 + import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - import 'package:device_info_platform_interface/device_info_platform_interface.dart'; - import 'package:device_info_platform_interface/method_channel/method_channel_device_info.dart'; void main() { diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart index 3fc3471dcdfb..435f307e0039 100755 --- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart +++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 +// @dart = 2.9 import 'dart:async'; diff --git a/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart b/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart index 763d32642cfa..80faba404154 100755 --- a/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart +++ b/packages/shared_preferences/shared_preferences/test/shared_preferences_test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 +// @dart = 2.9 import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/packages/url_launcher/url_launcher/example/integration_test/url_launcher_test.dart b/packages/url_launcher/url_launcher/example/integration_test/url_launcher_test.dart index 9fb5eaa34b4c..6ab7c4b17cc1 100644 --- a/packages/url_launcher/url_launcher/example/integration_test/url_launcher_test.dart +++ b/packages/url_launcher/url_launcher/example/integration_test/url_launcher_test.dart @@ -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(egarciad): Remove once integration_test is migrated to null safety. +// @dart = 2.9 + import 'dart:io' show Platform; import 'package:flutter/foundation.dart' show kIsWeb; diff --git a/packages/url_launcher/url_launcher/example/lib/main.dart b/packages/url_launcher/url_launcher/example/lib/main.dart index f493e6121401..b3e65f38a794 100644 --- a/packages/url_launcher/url_launcher/example/lib/main.dart +++ b/packages/url_launcher/url_launcher/example/lib/main.dart @@ -35,7 +35,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - late Future _launched; + Future? _launched; String _phone = ''; Future _launchInBrowser(String url) async { diff --git a/packages/url_launcher/url_launcher/example/test/url_launcher_example_test.dart b/packages/url_launcher/url_launcher/example/test/url_launcher_example_test.dart index 41b9f6f5ec6c..eddc126a8e66 100644 --- a/packages/url_launcher/url_launcher/example/test/url_launcher_example_test.dart +++ b/packages/url_launcher/url_launcher/example/test/url_launcher_example_test.dart @@ -1,3 +1,10 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(egarciad): Remove once mockito is migrated to null safety. +// @dart = 2.9 + import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/material.dart'; import 'package:mockito/mockito.dart'; diff --git a/packages/url_launcher/url_launcher/example/test_driver/integration_test.dart b/packages/url_launcher/url_launcher/example/test_driver/integration_test.dart index 7a2c21338786..e56756f38cbd 100644 --- a/packages/url_launcher/url_launcher/example/test_driver/integration_test.dart +++ b/packages/url_launcher/url_launcher/example/test_driver/integration_test.dart @@ -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(egarciad): Remove once flutter_driver is migrated to null safety. +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 43688ff6954b..9e0cae460726 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -26,16 +26,31 @@ dependencies: flutter: sdk: flutter # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. - url_launcher_platform_interface: - path: ../url_launcher_platform_interface + url_launcher_platform_interface: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/url_launcher/url_launcher_platform_interface # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish # validation, so we set a ^ constraint. # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - url_launcher_linux: ^0.0.1 - url_launcher_macos: ^0.0.1 - url_launcher_windows: ^0.0.1 + url_launcher_linux: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/url_launcher/url_launcher_linux + url_launcher_macos: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/url_launcher/url_launcher_macos + url_launcher_windows: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/url_launcher/url_launcher_windows # TODO(mvanbeusekom): Temporary disabled until web is migrated to nnbd (advised by @blasten). #url_launcher_web: ^0.1.3 diff --git a/packages/url_launcher/url_launcher/test/url_launcher_test.dart b/packages/url_launcher/url_launcher/test/url_launcher_test.dart index 1934d8af2ad3..89a7801e1ca8 100644 --- a/packages/url_launcher/url_launcher/test/url_launcher_test.dart +++ b/packages/url_launcher/url_launcher/test/url_launcher_test.dart @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 +// TODO(mvanbeusekom): Remove once Mockito is migrated to null safety. +// @dart = 2.9 import 'dart:async'; import 'dart:ui'; import 'package:flutter_test/flutter_test.dart'; -// TODO(mvanbeusekom): Remove once Mockito is migrated to null safety. -// @dart = 2.9 import 'package:mockito/mockito.dart'; import 'package:flutter/foundation.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; diff --git a/packages/url_launcher/url_launcher_linux/CHANGELOG.md b/packages/url_launcher/url_launcher_linux/CHANGELOG.md index 7855c4a33341..12f0ff5fc451 100644 --- a/packages/url_launcher/url_launcher_linux/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_linux/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.0-nullsafety + +* Migrate to null safety. + ## 0.0.1+2 * Check in linux/ directory for example/ diff --git a/packages/url_launcher/url_launcher_linux/pubspec.yaml b/packages/url_launcher/url_launcher_linux/pubspec.yaml index 2e3a1ba37cd4..9cb9e82efd59 100644 --- a/packages/url_launcher/url_launcher_linux/pubspec.yaml +++ b/packages/url_launcher/url_launcher_linux/pubspec.yaml @@ -1,6 +1,6 @@ name: url_launcher_linux description: Linux implementation of the url_launcher plugin. -version: 0.0.1+2 +version: 0.1.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_linux flutter: @@ -10,7 +10,7 @@ flutter: pluginClass: UrlLauncherPlugin environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.10.0-56.0.dev <3.0.0" flutter: ">=1.12.8 <2.0.0" dependencies: diff --git a/packages/url_launcher/url_launcher_macos/CHANGELOG.md b/packages/url_launcher/url_launcher_macos/CHANGELOG.md index d52bf8c249e6..a43df4590ed0 100644 --- a/packages/url_launcher/url_launcher_macos/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_macos/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.1.0-nullsafety + +* Migrate to null safety. + # 0.0.1+8 * Remove no-op android folder in the example app. diff --git a/packages/url_launcher/url_launcher_macos/pubspec.yaml b/packages/url_launcher/url_launcher_macos/pubspec.yaml index 4775f23fe36a..e071918e6649 100644 --- a/packages/url_launcher/url_launcher_macos/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/pubspec.yaml @@ -3,7 +3,7 @@ description: macOS implementation of the url_launcher plugin. # 0.0.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.0.1+8 +version: 0.1.0 homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_macos flutter: @@ -14,7 +14,7 @@ flutter: fileName: url_launcher_macos.dart environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.10.0-56.0.dev <3.0.0" flutter: ">=1.12.8 <2.0.0" dependencies: diff --git a/packages/url_launcher/url_launcher_web/CHANGELOG.md b/packages/url_launcher/url_launcher_web/CHANGELOG.md index 456d458834bf..e47d2d118270 100644 --- a/packages/url_launcher/url_launcher_web/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_web/CHANGELOG.md @@ -29,7 +29,7 @@ # 0.1.2 -- Adds "tel" and "sms" support +- Adds "tel" and "sms" support # 0.1.1+6 diff --git a/packages/url_launcher/url_launcher_web/analysis_options.yaml b/packages/url_launcher/url_launcher_web/analysis_options.yaml deleted file mode 100644 index 3d64bb57fe49..000000000000 --- a/packages/url_launcher/url_launcher_web/analysis_options.yaml +++ /dev/null @@ -1,4 +0,0 @@ -include: ../../../analysis_options.yaml -analyzer: - enable-experiment: - - non-nullable diff --git a/packages/url_launcher/url_launcher_web/pubspec.yaml b/packages/url_launcher/url_launcher_web/pubspec.yaml index 0fa5b35d4014..dab37acbf215 100644 --- a/packages/url_launcher/url_launcher_web/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/pubspec.yaml @@ -15,8 +15,11 @@ flutter: dependencies: # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. - url_launcher_platform_interface: - path: ../url_launcher_platform_interface + url_launcher_platform_interface: + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/url_launcher/url_launcher_platform_interface flutter: sdk: flutter flutter_web_plugins: diff --git a/packages/url_launcher/url_launcher_windows/CHANGELOG.md b/packages/url_launcher/url_launcher_windows/CHANGELOG.md index 7f534a7e5a38..30657d82a98c 100644 --- a/packages/url_launcher/url_launcher_windows/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_windows/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.0-nullsafety + +* Migrate to null-safety. + ## 0.0.1+1 * Update README to reflect endorsement. diff --git a/packages/url_launcher/url_launcher_windows/pubspec.yaml b/packages/url_launcher/url_launcher_windows/pubspec.yaml index 6a653b7f7665..39ea2d2fb9b9 100644 --- a/packages/url_launcher/url_launcher_windows/pubspec.yaml +++ b/packages/url_launcher/url_launcher_windows/pubspec.yaml @@ -3,7 +3,7 @@ description: Windows implementation of the url_launcher plugin. # 0.0.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.0.1+1 +version: 0.1.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_windows flutter: @@ -13,7 +13,7 @@ flutter: pluginClass: UrlLauncherPlugin environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.10.0-56.0.dev <3.0.0" flutter: ">=1.12.8 <2.0.0" dependencies: diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index 36d5758ac15e..e11ae1457831 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -24,11 +24,10 @@ flutter: dependencies: meta: ^1.3.0-nullsafety.3 video_player_platform_interface: - path: ../video_player_platform_interface - # git: - # url: https://github.com/flutter/plugins.git - # ref: nnbd - # path: packages/video_player/video_player_platform_interface + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/video_player/video_player_platform_interface # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish @@ -36,7 +35,10 @@ dependencies: # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 video_player_web: - path: ../video_player_web + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/video_player/video_player_web flutter: sdk: flutter diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index e566946489d9..10439a306bc3 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -23,11 +23,10 @@ dependencies: sdk: flutter meta: ^1.3.0-nullsafety.3 video_player_platform_interface: - path: ../video_player_platform_interface - # git: - # url: https://github.com/flutter/plugins.git - # ref: nnbd - # path: packages/video_player/video_player_platform_interface + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/video_player/video_player_platform_interface dev_dependencies: flutter_test: From a26f14fb9b91a9c4c80dbaa766dd997a633de4f0 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 23 Oct 2020 14:57:47 -0700 Subject: [PATCH 11/58] [url_launcher] Migrates Link to null safety (#3196) --- .../url_launcher/lib/src/link.dart | 21 +++++++++---------- .../url_launcher/test/link_test.dart | 3 ++- .../lib/link.dart | 14 ++++++++----- .../lib/method_channel_url_launcher.dart | 2 +- .../lib/url_launcher_platform_interface.dart | 2 +- .../test/link_test.dart | 3 +++ 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/packages/url_launcher/url_launcher/lib/src/link.dart b/packages/url_launcher/url_launcher/lib/src/link.dart index bd54789accfb..f859bc4ad2cf 100644 --- a/packages/url_launcher/url_launcher/lib/src/link.dart +++ b/packages/url_launcher/url_launcher/lib/src/link.dart @@ -40,7 +40,7 @@ class Link extends StatelessWidget implements LinkInfo { final LinkWidgetBuilder builder; /// The destination that this link leads to. - final Uri uri; + final Uri? uri; /// The target indicating where to open the link. final LinkTarget target; @@ -51,12 +51,11 @@ class Link extends StatelessWidget implements LinkInfo { /// Creates a widget that renders a real link on the web, and uses WebViews in /// native platforms to open links. Link({ - Key key, - @required this.uri, - LinkTarget target, - @required this.builder, - }) : target = target ?? LinkTarget.defaultTarget, - super(key: key); + Key? key, + required this.uri, + this.target = LinkTarget.defaultTarget, + required this.builder, + }) : super(key: key); LinkDelegate get _effectiveDelegate { return UrlLauncherPlatform.instance.linkDelegate ?? @@ -90,16 +89,17 @@ class DefaultLinkDelegate extends StatelessWidget { bool get _useWebView { if (link.target == LinkTarget.self) return true; if (link.target == LinkTarget.blank) return false; - return null; + return false; } Future _followLink(BuildContext context) async { - if (!link.uri.hasScheme) { + if (!link.uri!.hasScheme) { // A uri that doesn't have a scheme is an internal route name. In this // case, we push it via Flutter's navigation system instead of letting the // browser handle it. final String routeName = link.uri.toString(); - return pushRouteNameToFramework(context, routeName); + await pushRouteNameToFramework(context, routeName); + return; } // At this point, we know that the link is external. So we use the `launch` @@ -119,7 +119,6 @@ class DefaultLinkDelegate extends StatelessWidget { context: ErrorDescription('during launching a link'), )); } - return Future.value(null); } @override diff --git a/packages/url_launcher/url_launcher/test/link_test.dart b/packages/url_launcher/url_launcher/test/link_test.dart index d525153dc0a0..46903aadaede 100644 --- a/packages/url_launcher/url_launcher/test/link_test.dart +++ b/packages/url_launcher/url_launcher/test/link_test.dart @@ -2,7 +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(egarciad): Remove once Mockito has been migrated to null safety. +// @dart = 2.9 import 'dart:ui'; import 'package:flutter/material.dart'; diff --git a/packages/url_launcher/url_launcher_platform_interface/lib/link.dart b/packages/url_launcher/url_launcher_platform_interface/lib/link.dart index 425dc886d29f..a176972e06bd 100644 --- a/packages/url_launcher/url_launcher_platform_interface/lib/link.dart +++ b/packages/url_launcher/url_launcher_platform_interface/lib/link.dart @@ -16,7 +16,7 @@ typedef FollowLink = Future Function(); /// the widget tree under it. typedef LinkWidgetBuilder = Widget Function( BuildContext context, - FollowLink followLink, + FollowLink? followLink, ); /// Signature for a delegate function to build the [Link] widget. @@ -31,7 +31,7 @@ final MethodCodec _codec = const JSONMethodCodec(); class LinkTarget { /// Const private constructor with a [debugLabel] to allow the creation of /// multiple distinct const instances. - const LinkTarget._({this.debugLabel}); + const LinkTarget._({required this.debugLabel}); /// Used to distinguish multiple const instances of [LinkTarget]. final String debugLabel; @@ -64,7 +64,7 @@ abstract class LinkInfo { LinkWidgetBuilder get builder; /// The destination that this link leads to. - Uri get uri; + Uri? get uri; /// The target indicating where to open the link. LinkTarget get target; @@ -80,10 +80,14 @@ Future pushRouteNameToFramework( String routeName, { @visibleForTesting bool debugForceRouter = false, }) { + final PlatformMessageCallback? onPlatformMessage = window.onPlatformMessage; + if (onPlatformMessage == null) { + return Future.value(null); + } final Completer completer = Completer(); if (debugForceRouter || _hasRouter(context)) { SystemNavigator.routeInformationUpdated(location: routeName); - window.onPlatformMessage( + onPlatformMessage( 'flutter/navigation', _codec.encodeMethodCall( MethodCall('pushRouteInformation', { @@ -94,7 +98,7 @@ Future pushRouteNameToFramework( completer.complete, ); } else { - window.onPlatformMessage( + onPlatformMessage( 'flutter/navigation', _codec.encodeMethodCall(MethodCall('pushRoute', routeName)), completer.complete, diff --git a/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart b/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart index a67d045c563e..7b9dfc9cc5cf 100644 --- a/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart +++ b/packages/url_launcher/url_launcher_platform_interface/lib/method_channel_url_launcher.dart @@ -14,7 +14,7 @@ const MethodChannel _channel = MethodChannel('plugins.flutter.io/url_launcher'); /// An implementation of [UrlLauncherPlatform] that uses method channels. class MethodChannelUrlLauncher extends UrlLauncherPlatform { @override - final LinkDelegate linkDelegate = null; + final LinkDelegate? linkDelegate = null; @override Future canLaunch(String url) { diff --git a/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart b/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart index 2969002bc71a..2a4edfa8d1af 100644 --- a/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart +++ b/packages/url_launcher/url_launcher_platform_interface/lib/url_launcher_platform_interface.dart @@ -39,7 +39,7 @@ abstract class UrlLauncherPlatform extends PlatformInterface { } /// The delegate used by the Link widget to build itself. - LinkDelegate get linkDelegate; + LinkDelegate? get linkDelegate; /// Returns `true` if this platform is able to launch [url]. Future canLaunch(String url) { diff --git a/packages/url_launcher/url_launcher_platform_interface/test/link_test.dart b/packages/url_launcher/url_launcher_platform_interface/test/link_test.dart index 99a885ccc179..58cdd22dca02 100644 --- a/packages/url_launcher/url_launcher_platform_interface/test/link_test.dart +++ b/packages/url_launcher/url_launcher_platform_interface/test/link_test.dart @@ -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(egarciad): Remove once Mockito has been migrated to null safety. +// @dart = 2.9 + import 'dart:ui'; import 'package:mockito/mockito.dart'; From b597e4b9da71d3571aa29e6f7adaccc620928967 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 23 Oct 2020 14:58:55 -0700 Subject: [PATCH 12/58] [connectivity][connectvity_platform_interface] migrate to nnbd (#3176) --- .../connectivity/connectivity/CHANGELOG.md | 4 ++ .../connectivity/analysis_options.yaml | 4 ++ .../connectivity/example/lib/main.dart | 6 +-- .../connectivity/example/pubspec.yaml | 4 +- .../integration_test/connectivity_test.dart | 3 ++ .../integration_test/connectivity_test.dart | 4 ++ .../connectivity/lib/connectivity.dart | 4 +- .../connectivity/connectivity/pubspec.yaml | 21 +++++--- .../connectivity/test/connectivity_test.dart | 2 +- .../CHANGELOG.md | 4 ++ .../analysis_options.yaml | 4 ++ .../lib/connectivity_platform_interface.dart | 6 +-- .../lib/src/method_channel_connectivity.dart | 49 ++++++++++--------- .../pubspec.yaml | 14 ++++-- .../method_channel_connectivity_test.dart | 10 ++-- script/incremental_build.sh | 2 + 16 files changed, 90 insertions(+), 51 deletions(-) create mode 100644 packages/connectivity/connectivity/analysis_options.yaml create mode 100644 packages/connectivity/connectivity_platform_interface/analysis_options.yaml diff --git a/packages/connectivity/connectivity/CHANGELOG.md b/packages/connectivity/connectivity/CHANGELOG.md index 8e2802ab5b04..cc6897be8637 100644 --- a/packages/connectivity/connectivity/CHANGELOG.md +++ b/packages/connectivity/connectivity/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.0-nullsafety + +* Migrate to null safety. + ## 2.0.0 * [Breaking Change] The `getWifiName`, `getWifiBSSID` and `getWifiIP` are removed to [wifi_info_flutter](https://github.com/flutter/plugins/tree/master/packages/wifi_info_flutter) diff --git a/packages/connectivity/connectivity/analysis_options.yaml b/packages/connectivity/connectivity/analysis_options.yaml new file mode 100644 index 000000000000..3d64bb57fe49 --- /dev/null +++ b/packages/connectivity/connectivity/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable diff --git a/packages/connectivity/connectivity/example/lib/main.dart b/packages/connectivity/connectivity/example/lib/main.dart index e05497136b86..19285ce889fd 100644 --- a/packages/connectivity/connectivity/example/lib/main.dart +++ b/packages/connectivity/connectivity/example/lib/main.dart @@ -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; @@ -51,7 +51,7 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { String _connectionStatus = 'Unknown'; final Connectivity _connectivity = Connectivity(); - StreamSubscription _connectivitySubscription; + late StreamSubscription _connectivitySubscription; @override void initState() { @@ -69,7 +69,7 @@ class _MyHomePageState extends State { // Platform messages are asynchronous, so we initialize in an async method. Future initConnectivity() async { - ConnectivityResult result; + ConnectivityResult result = ConnectivityResult.none; // Platform messages may fail, so we use a try/catch PlatformException. try { result = await _connectivity.checkConnectivity(); diff --git a/packages/connectivity/connectivity/example/pubspec.yaml b/packages/connectivity/connectivity/example/pubspec.yaml index 1d07f7d19e60..976ff6e71e69 100644 --- a/packages/connectivity/connectivity/example/pubspec.yaml +++ b/packages/connectivity/connectivity/example/pubspec.yaml @@ -10,10 +10,10 @@ dependencies: dev_dependencies: flutter_driver: sdk: flutter - test: any + 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 diff --git a/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart b/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart index d48deae3403d..3177b66ea48a 100644 --- a/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart +++ b/packages/connectivity/connectivity/example/test_driver/integration_test/connectivity_test.dart @@ -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'; diff --git a/packages/connectivity/connectivity/integration_test/connectivity_test.dart b/packages/connectivity/connectivity/integration_test/connectivity_test.dart index d48deae3403d..efb4602d5a35 100644 --- a/packages/connectivity/connectivity/integration_test/connectivity_test.dart +++ b/packages/connectivity/connectivity/integration_test/connectivity_test.dart @@ -2,10 +2,14 @@ // 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'; + void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/connectivity/connectivity/lib/connectivity.dart b/packages/connectivity/connectivity/lib/connectivity.dart index c9655365f772..0f30a9347b74 100644 --- a/packages/connectivity/connectivity/lib/connectivity.dart +++ b/packages/connectivity/connectivity/lib/connectivity.dart @@ -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; diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index af26f703d8b9..114692c2ecdb 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -2,7 +2,10 @@ 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.0 +version: 3.0.0-nullsafety + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none flutter: plugin: @@ -21,22 +24,26 @@ dependencies: flutter: sdk: flutter meta: ^1.0.5 - connectivity_platform_interface: ^1.0.2 + connectivity_platform_interface: + path: ../connectivity_platform_interface + #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: any + 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: + path: ../../plugin_platform_interface + pedantic: ^1.10.0-nullsafety.1 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" diff --git a/packages/connectivity/connectivity/test/connectivity_test.dart b/packages/connectivity/connectivity/test/connectivity_test.dart index 846d5d0ebe16..e83196546cd2 100644 --- a/packages/connectivity/connectivity/test/connectivity_test.dart +++ b/packages/connectivity/connectivity/test/connectivity_test.dart @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// 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'; diff --git a/packages/connectivity/connectivity_platform_interface/CHANGELOG.md b/packages/connectivity/connectivity_platform_interface/CHANGELOG.md index e45f8f7e4d99..dec275293ef9 100644 --- a/packages/connectivity/connectivity_platform_interface/CHANGELOG.md +++ b/packages/connectivity/connectivity_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety + +* Migrate to null safety. + ## 1.0.6 * Update lower bound of dart dependency to 2.1.0. diff --git a/packages/connectivity/connectivity_platform_interface/analysis_options.yaml b/packages/connectivity/connectivity_platform_interface/analysis_options.yaml new file mode 100644 index 000000000000..3d64bb57fe49 --- /dev/null +++ b/packages/connectivity/connectivity_platform_interface/analysis_options.yaml @@ -0,0 +1,4 @@ +include: ../../../analysis_options.yaml +analyzer: + enable-experiment: + - non-nullable diff --git a/packages/connectivity/connectivity_platform_interface/lib/connectivity_platform_interface.dart b/packages/connectivity/connectivity_platform_interface/lib/connectivity_platform_interface.dart index cfd9cf648a9c..8e9f0fd6af06 100644 --- a/packages/connectivity/connectivity_platform_interface/lib/connectivity_platform_interface.dart +++ b/packages/connectivity/connectivity_platform_interface/lib/connectivity_platform_interface.dart @@ -50,17 +50,17 @@ abstract class ConnectivityPlatform extends PlatformInterface { } /// Obtains the wifi name (SSID) of the connected network - Future getWifiName() { + Future getWifiName() { throw UnimplementedError('getWifiName() has not been implemented.'); } /// Obtains the wifi BSSID of the connected network. - Future getWifiBSSID() { + Future getWifiBSSID() { throw UnimplementedError('getWifiBSSID() has not been implemented.'); } /// Obtains the IP address of the connected wifi network - Future getWifiIP() { + Future getWifiIP() { throw UnimplementedError('getWifiIP() has not been implemented.'); } diff --git a/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart b/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart index 87deaa21ea3b..8a47c819cbcb 100644 --- a/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart +++ b/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart @@ -8,6 +8,7 @@ import 'package:connectivity_platform_interface/connectivity_platform_interface. import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; +import 'utils.dart'; import 'utils.dart'; /// An implementation of [ConnectivityPlatform] that uses method channels. @@ -22,29 +23,29 @@ class MethodChannelConnectivity extends ConnectivityPlatform { EventChannel eventChannel = EventChannel('plugins.flutter.io/connectivity_status'); - Stream _onConnectivityChanged; + Stream? _onConnectivityChanged; /// Fires whenever the connectivity state changes. Stream 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 checkConnectivity() { - return methodChannel - .invokeMethod('check') - .then(parseConnectivityResult); + Future checkConnectivity() async { + final String checkResult = + await methodChannel.invokeMethod('check') ?? ''; + return parseConnectivityResult(checkResult); } @override - Future getWifiName() async { - String wifiName = await methodChannel.invokeMethod('wifiName'); + Future getWifiName() async { + String? wifiName = await methodChannel.invokeMethod('wifiName'); // as Android might return , uniforming result // our iOS implementation will return null if (wifiName == '') { @@ -54,29 +55,31 @@ class MethodChannelConnectivity extends ConnectivityPlatform { } @override - Future getWifiBSSID() { + Future getWifiBSSID() { return methodChannel.invokeMethod('wifiBSSID'); } @override - Future getWifiIP() { + Future getWifiIP() { return methodChannel.invokeMethod('wifiIPAddress'); } @override Future requestLocationServiceAuthorization({ bool requestAlwaysLocationUsage = false, - }) { - return methodChannel.invokeMethod( - 'requestLocationServiceAuthorization', [ - requestAlwaysLocationUsage - ]).then(parseLocationAuthorizationStatus); + }) async { + final String requestLocationServiceResult = await methodChannel + .invokeMethod('requestLocationServiceAuthorization', + [requestAlwaysLocationUsage]) ?? + ''; + return parseLocationAuthorizationStatus(requestLocationServiceResult); } @override - Future getLocationServiceAuthorization() { - return methodChannel - .invokeMethod('getLocationServiceAuthorization') - .then(parseLocationAuthorizationStatus); + Future getLocationServiceAuthorization() async { + final String getLocationServiceResult = await methodChannel + .invokeMethod('getLocationServiceAuthorization') ?? + ''; + return parseLocationAuthorizationStatus(getLocationServiceResult); } } diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index 5bafcf9b806b..124825f7b386 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -3,19 +3,23 @@ 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.6 +version: 2.0.0-nullsafety + +# Don't publish this package until null safety is stable or the package is in the allow list. +publish_to: none dependencies: flutter: sdk: flutter - meta: ^1.0.5 - plugin_platform_interface: ^1.0.1 + meta: ^1.3.0-nullsafety.3 + plugin_platform_interface: + path: ../../plugin_platform_interface 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.10.0-56.0.dev <3.0.0' flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/connectivity/connectivity_platform_interface/test/method_channel_connectivity_test.dart b/packages/connectivity/connectivity_platform_interface/test/method_channel_connectivity_test.dart index 3d9c405c30ab..0c30530fc9ab 100644 --- a/packages/connectivity/connectivity_platform_interface/test/method_channel_connectivity_test.dart +++ b/packages/connectivity/connectivity_platform_interface/test/method_channel_connectivity_test.dart @@ -12,7 +12,7 @@ void main() { group('$MethodChannelConnectivity', () { final List log = []; - MethodChannelConnectivity methodChannelConnectivity; + late MethodChannelConnectivity methodChannelConnectivity; setUp(() async { methodChannelConnectivity = MethodChannelConnectivity(); @@ -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 @@ -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, @@ -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, @@ -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, diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 681b80e9ef9b..809229bb5f29 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -31,6 +31,8 @@ CUSTOM_ANALYSIS_PLUGINS=( "url_launcher/url_launcher" "device_info/device_info_platform_interface" "device_info/device_info" + "connectivity/connectivity_platform_interface" + "connectivity/connectivity" "url_launcher/url_launcher_web" ) # Comma-separated string of the list above From a985f126f991488987ae363cf250d47961280808 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 23 Oct 2020 15:10:39 -0700 Subject: [PATCH 13/58] [connectivity][connectivity_platform_interface] update to git deps (#3199) --- packages/connectivity/connectivity/pubspec.yaml | 10 ++++++++-- .../connectivity_platform_interface/pubspec.yaml | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index 114692c2ecdb..faef554fbeef 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -25,7 +25,10 @@ dependencies: sdk: flutter meta: ^1.0.5 connectivity_platform_interface: - path: ../connectivity_platform_interface + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/connectivity/connectivity_platform_interface #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 @@ -41,7 +44,10 @@ dev_dependencies: path: ../../integration_test mockito: ^4.1.1 plugin_platform_interface: - path: ../../plugin_platform_interface + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/plugin_platform_interface pedantic: ^1.10.0-nullsafety.1 environment: diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index 124825f7b386..add363a7b12a 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -13,7 +13,10 @@ dependencies: sdk: flutter meta: ^1.3.0-nullsafety.3 plugin_platform_interface: - path: ../../plugin_platform_interface + git: + url: https://github.com/flutter/plugins.git + ref: nnbd + path: packages/plugin_platform_interface dev_dependencies: flutter_test: From f32e26eb9d9512788bcda557a6287bb7b2d7948f Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 23 Oct 2020 15:11:48 -0700 Subject: [PATCH 14/58] [device_info_platform_interface] update to major version bump for nnbd (#3197) --- .../device_info/device_info_platform_interface/CHANGELOG.md | 2 +- .../device_info/device_info_platform_interface/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/device_info/device_info_platform_interface/CHANGELOG.md b/packages/device_info/device_info_platform_interface/CHANGELOG.md index f48c0a9cee21..fe9ded6b131f 100644 --- a/packages/device_info/device_info_platform_interface/CHANGELOG.md +++ b/packages/device_info/device_info_platform_interface/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.1.0-nullsafety +## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 666e0c529ebd..d28b468d9d6c 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the device_info plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 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.1.0-nullsafety +version: 2.0.0-nullsafety # Don't publish this package until null safety is stable or the package is in the allow list. publish_to: none From ca92553e6aa7ed906eb286ebf5c1c010d50c7ac5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 23 Oct 2020 17:04:11 -0700 Subject: [PATCH 15/58] Various fixes --- .../integration_test/connectivity_test.dart | 1 - .../lib/src/method_channel_connectivity.dart | 1 - .../url_launcher/url_launcher_web/pubspec.yaml | 16 +++++++++------- .../video_player/test/video_player_test.dart | 2 ++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/connectivity/connectivity/integration_test/connectivity_test.dart b/packages/connectivity/connectivity/integration_test/connectivity_test.dart index efb4602d5a35..3177b66ea48a 100644 --- a/packages/connectivity/connectivity/integration_test/connectivity_test.dart +++ b/packages/connectivity/connectivity/integration_test/connectivity_test.dart @@ -9,7 +9,6 @@ import 'package:integration_test/integration_test.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:connectivity/connectivity.dart'; - void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart b/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart index 8a47c819cbcb..b411b5bc069b 100644 --- a/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart +++ b/packages/connectivity/connectivity_platform_interface/lib/src/method_channel_connectivity.dart @@ -8,7 +8,6 @@ import 'package:connectivity_platform_interface/connectivity_platform_interface. import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; -import 'utils.dart'; import 'utils.dart'; /// An implementation of [ConnectivityPlatform] that uses method channels. diff --git a/packages/url_launcher/url_launcher_web/pubspec.yaml b/packages/url_launcher/url_launcher_web/pubspec.yaml index 22eb097ea25e..bb97b6c70cbf 100644 --- a/packages/url_launcher/url_launcher_web/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/pubspec.yaml @@ -14,12 +14,13 @@ flutter: fileName: url_launcher_web.dart dependencies: + url_launcher_platform_interface: ^1.0.9 # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. - url_launcher_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/url_launcher/url_launcher_platform_interface + # url_launcher_platform_interface: + # git: + # url: https://github.com/flutter/plugins.git + # ref: nnbd + # path: packages/url_launcher/url_launcher_platform_interface flutter: sdk: flutter flutter_web_plugins: @@ -29,9 +30,10 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + url_launcher: ^5.2.5 # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. - url_launcher: - path: ../url_launcher + # url_launcher: + # path: ../url_launcher pedantic: ^1.8.0 mockito: ^4.1.1 integration_test: diff --git a/packages/video_player/video_player/test/video_player_test.dart b/packages/video_player/video_player/test/video_player_test.dart index 4cb559b00c02..3e149cfbe311 100644 --- a/packages/video_player/video_player/test/video_player_test.dart +++ b/packages/video_player/video_player/test/video_player_test.dart @@ -541,6 +541,7 @@ void main() { final List buffered = [ DurationRange(const Duration(seconds: 0), const Duration(seconds: 4)) ]; + const bool isInitialized = true; const bool isPlaying = true; const bool isLooping = true; const bool isBuffering = true; @@ -553,6 +554,7 @@ void main() { position: position, caption: caption, buffered: buffered, + isInitialized: isInitialized, isPlaying: isPlaying, isLooping: isLooping, isBuffering: isBuffering, From ae2a6c546beae45e8083fb5b9554e11d5a65dba2 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 23 Oct 2020 17:53:16 -0700 Subject: [PATCH 16/58] Fix video_player test --- .../video_player/video_player/test/video_player_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/video_player/video_player/test/video_player_test.dart b/packages/video_player/video_player/test/video_player_test.dart index 3e149cfbe311..7dec747d47a7 100644 --- a/packages/video_player/video_player/test/video_player_test.dart +++ b/packages/video_player/video_player/test/video_player_test.dart @@ -509,7 +509,7 @@ void main() { expect(uninitialized.size, equals(Size.zero)); expect(uninitialized.isInitialized, isFalse); expect(uninitialized.hasError, isFalse); - expect(uninitialized.aspectRatio, 0.0); + expect(uninitialized.aspectRatio, 1.0); }); test('erroneous()', () { @@ -529,7 +529,7 @@ void main() { expect(error.size, equals(Size.zero)); expect(error.isInitialized, isFalse); expect(error.hasError, isTrue); - expect(error.aspectRatio, 0.0); + expect(error.aspectRatio, 1.0); }); test('toString()', () { From 9b8a971a3131119dd9503a9e4b3e4ef60791d8a4 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 18:25:43 -0700 Subject: [PATCH 17/58] [plugin_platform_interface] Allow to publish --- packages/plugin_platform_interface/pubspec.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index b1454bb82d1e..d79dbb8db3a6 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -19,9 +19,6 @@ repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platf environment: sdk: '>=2.10.0-56.0.dev <3.0.0' -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - dependencies: meta: ^1.3.0-nullsafety.3 From aad2e72d93e8d4c9862e64a36bbf435ad08db41b Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 18:54:23 -0700 Subject: [PATCH 18/58] Change plugin_platform_interface git to pub version --- packages/connectivity/connectivity/pubspec.yaml | 6 +----- .../connectivity_platform_interface/pubspec.yaml | 6 +----- .../device_info_platform_interface/pubspec.yaml | 6 +----- packages/url_launcher/url_launcher/example/pubspec.yaml | 7 +------ packages/url_launcher/url_launcher/pubspec.yaml | 7 +------ .../url_launcher_platform_interface/pubspec.yaml | 7 +------ 6 files changed, 6 insertions(+), 33 deletions(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index faef554fbeef..22971d643171 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -43,11 +43,7 @@ dev_dependencies: integration_test: path: ../../integration_test mockito: ^4.1.1 - plugin_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/plugin_platform_interface + plugin_platform_interface: 1.1.0-nullsafety pedantic: ^1.10.0-nullsafety.1 environment: diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index add363a7b12a..26a48fab8045 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -12,11 +12,7 @@ dependencies: flutter: sdk: flutter meta: ^1.3.0-nullsafety.3 - plugin_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/plugin_platform_interface + plugin_platform_interface: 1.1.0-nullsafety dev_dependencies: flutter_test: diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index d28b468d9d6c..044a8231ae9d 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -12,11 +12,7 @@ dependencies: flutter: sdk: flutter meta: ^1.3.0-nullsafety.3 - plugin_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/plugin_platform_interface + plugin_platform_interface: 1.1.0-nullsafety dev_dependencies: flutter_test: diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index 7e464dec6fe3..4a833f0f51d0 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -14,12 +14,7 @@ dev_dependencies: sdk: flutter pedantic: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - # TODO (mvanbeusekom): Update to use pub.dev once 1.10.0-nullsafety released. - plugin_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/plugin_platform_interface + plugin_platform_interface: 1.1.0-nullsafety flutter: uses-material-design: true diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 9e0cae460726..8e3a19a9bedf 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -59,12 +59,7 @@ dev_dependencies: sdk: flutter test: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - # TODO (mvanbeusekom): Update to use pub.dev once 1.10.0-nullsafety released. - plugin_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/plugin_platform_interface + plugin_platform_interface: 1.1.0-nullsafety pedantic: ^1.10.0-nullsafety.1 environment: diff --git a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml index cbe2cf05e043..f5ea35db2491 100644 --- a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml +++ b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml @@ -8,12 +8,7 @@ version: 2.0.0-nullsafety dependencies: flutter: sdk: flutter - # TODO (mvanbeusekom): Update to use pub.dev once 1.10.0-nullsafety released. - plugin_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/plugin_platform_interface + plugin_platform_interface: 1.1.0-nullsafety dev_dependencies: flutter_test: From 1ca31984a14c60bcd301e2578fa3be662f1def30 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 18:57:56 -0700 Subject: [PATCH 19/58] [connectivity_platform_interface] Allow to publish --- .../connectivity/connectivity_platform_interface/pubspec.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index 26a48fab8045..f26107c5e9c0 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -5,9 +5,6 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/c # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes version: 2.0.0-nullsafety -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - dependencies: flutter: sdk: flutter From c025add2496b9035c2f177a9ebc7b3a94339cbe7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 19:01:55 -0700 Subject: [PATCH 20/58] [connectivity] Allow to publish --- packages/connectivity/connectivity/pubspec.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index 22971d643171..063b45edb836 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -4,9 +4,6 @@ description: Flutter plugin for discovering the state of the network (WiFi & homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity version: 3.0.0-nullsafety -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - flutter: plugin: platforms: @@ -24,11 +21,7 @@ dependencies: flutter: sdk: flutter meta: ^1.0.5 - connectivity_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/connectivity/connectivity_platform_interface + connectivity_platform_interface: 2.0.0-nullsafety #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 From 4dccf1f60aee2aad7768b96ad60ca76a5b9143ec Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 19:03:34 -0700 Subject: [PATCH 21/58] [device_info_platform_interface] Allow to publish --- .../device_info/device_info_platform_interface/pubspec.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 044a8231ae9d..d9c3264c4747 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -5,9 +5,6 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes version: 2.0.0-nullsafety -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - dependencies: flutter: sdk: flutter From 0b15324e84f4e3e76584ce4fd4d8d7b678bedbdb Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 19:09:12 -0700 Subject: [PATCH 22/58] [device_info] Allow to publish --- packages/device_info/device_info/pubspec.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index b45124095832..1f1e9b6509fe 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -7,9 +7,6 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 version: 0.5.0-nullsafety -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - flutter: plugin: platforms: @@ -22,11 +19,7 @@ flutter: dependencies: flutter: sdk: flutter - device_info_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/device_info/device_info_platform_interface + device_info_platform_interface: 2.0.0-nullsafety dev_dependencies: test: ^1.10.0-nullsafety.1 flutter_test: From e5bef4cb8ae6afbb196c1b73976b77f5656a9991 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 19:09:33 -0700 Subject: [PATCH 23/58] [video_player_platform_interface] Allow to publish --- .../video_player/video_player_platform_interface/pubspec.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml index e9850a6ddc79..7394a3391952 100644 --- a/packages/video_player/video_player_platform_interface/pubspec.yaml +++ b/packages/video_player/video_player_platform_interface/pubspec.yaml @@ -16,9 +16,6 @@ dev_dependencies: mockito: ^4.1.1 pedantic: ^1.10.0-nullsafety.1 -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - environment: sdk: ">=2.10.0-56.0.dev <3.0.0" flutter: ">=1.10.0 <2.0.0" From 59e125e634effc93cf1dbbe706a0dcc2ceebdbf4 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 27 Oct 2020 19:18:08 -0700 Subject: [PATCH 24/58] [url_launcher_macos] Fix pubspec version --- packages/url_launcher/url_launcher_macos/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/url_launcher/url_launcher_macos/pubspec.yaml b/packages/url_launcher/url_launcher_macos/pubspec.yaml index e071918e6649..8c48c6d9d303 100644 --- a/packages/url_launcher/url_launcher_macos/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/pubspec.yaml @@ -3,7 +3,7 @@ description: macOS implementation of the url_launcher plugin. # 0.0.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.1.0 +version: 0.1.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_macos flutter: From c98182b59fe7cbe2a43450b0e42c6c50ad9d0367 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 09:28:43 -0700 Subject: [PATCH 25/58] [video_player] Fix version in pubspec --- packages/video_player/video_player/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index e11ae1457831..cf7c342a1935 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter # 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.12.0 +version: 0.12.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player # Don't publish this package until null safety is stable or the package is in the allow list. From 5b0309cd2df6dbc90cf83529254dd07695c8ff27 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:28:03 -0700 Subject: [PATCH 26/58] [device_info][video_player] Fix versions --- packages/device_info/device_info/CHANGELOG.md | 2 +- packages/device_info/device_info/pubspec.yaml | 2 +- packages/video_player/video_player/CHANGELOG.md | 2 +- packages/video_player/video_player/pubspec.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/device_info/device_info/CHANGELOG.md b/packages/device_info/device_info/CHANGELOG.md index bf179e645ee1..763fd9f425bb 100644 --- a/packages/device_info/device_info/CHANGELOG.md +++ b/packages/device_info/device_info/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.5.0-nullsafety +## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index 1f1e9b6509fe..a356376a736b 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.5.0-nullsafety +version: 2.0.0-nullsafety flutter: plugin: diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md index 8c770220aef8..7ace298b6cf4 100644 --- a/packages/video_player/video_player/CHANGELOG.md +++ b/packages/video_player/video_player/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.12.0 +## 2.0.0 * Migration to null safety. diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index cf7c342a1935..15465cfef68a 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter # 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.12.0-nullsafety +version: 2.0.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player # Don't publish this package until null safety is stable or the package is in the allow list. From 512b393e35ec12d91042ebc39a0836b29ad727df Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:29:42 -0700 Subject: [PATCH 27/58] [video_player] Fix changelog --- packages/video_player/video_player/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md index 7ace298b6cf4..acac56447d7e 100644 --- a/packages/video_player/video_player/CHANGELOG.md +++ b/packages/video_player/video_player/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.0 +## 2.0.0-nullsafety * Migration to null safety. From e40bd96cff51d135b5611b5f20415164675c1d58 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:32:44 -0700 Subject: [PATCH 28/58] [url_launcher] Update dependencies --- .../url_launcher/url_launcher/pubspec.yaml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 8e3a19a9bedf..849edbcbd3d7 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -36,21 +36,9 @@ dependencies: # validation, so we set a ^ constraint. # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - url_launcher_linux: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/url_launcher/url_launcher_linux - url_launcher_macos: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/url_launcher/url_launcher_macos - url_launcher_windows: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/url_launcher/url_launcher_windows + url_launcher_linux: 0.1.0-nullsafety + url_launcher_macos: 0.1.0-nullsafety + url_launcher_windows: 0.1.0-nullsafety # TODO(mvanbeusekom): Temporary disabled until web is migrated to nnbd (advised by @blasten). #url_launcher_web: ^0.1.3 From f3dd76f1a282afe795b5bab741adc5fbec5e9416 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:36:07 -0700 Subject: [PATCH 29/58] [url_launcher] Fix dependencies --- packages/url_launcher/url_launcher/pubspec.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 849edbcbd3d7..0ec7409a24af 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -25,20 +25,15 @@ flutter: dependencies: flutter: sdk: flutter - # TODO(mvanbeusekom): Update to use pub.dev once null safety version is published. - url_launcher_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/url_launcher/url_launcher_platform_interface + url_launcher_platform_interface: ^2.0.0-nullsafety # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish # validation, so we set a ^ constraint. # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - url_launcher_linux: 0.1.0-nullsafety - url_launcher_macos: 0.1.0-nullsafety - url_launcher_windows: 0.1.0-nullsafety + url_launcher_linux: ^0.1.0-nullsafety + url_launcher_macos: ^0.1.0-nullsafety + url_launcher_windows: ^0.1.0-nullsafety # TODO(mvanbeusekom): Temporary disabled until web is migrated to nnbd (advised by @blasten). #url_launcher_web: ^0.1.3 From 31664cf936a72182e159b981c11c41ad240b9001 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:38:18 -0700 Subject: [PATCH 30/58] [device_info] Fix pubspec version --- packages/device_info/device_info/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index a356376a736b..fed08f9bbae3 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -19,7 +19,7 @@ flutter: dependencies: flutter: sdk: flutter - device_info_platform_interface: 2.0.0-nullsafety + device_info_platform_interface: ^2.0.0-nullsafety dev_dependencies: test: ^1.10.0-nullsafety.1 flutter_test: From 72949fef2f0458b5a758cd2ab49a24aef1de6778 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:45:12 -0700 Subject: [PATCH 31/58] [video_player_web] Fix version --- packages/video_player/video_player_web/CHANGELOG.md | 2 +- packages/video_player/video_player_web/pubspec.yaml | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/video_player/video_player_web/CHANGELOG.md b/packages/video_player/video_player_web/CHANGELOG.md index 732f7878ddb0..d0358100e9da 100644 --- a/packages/video_player/video_player_web/CHANGELOG.md +++ b/packages/video_player/video_player_web/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.2.0 +## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index 10439a306bc3..b934df381035 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/v # 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.2.0 +version: 2.0.0-nullsafety # Don't publish this package until null safety is stable or the package is in the allow list. publish_to: none @@ -22,11 +22,7 @@ dependencies: flutter_web_plugins: sdk: flutter meta: ^1.3.0-nullsafety.3 - video_player_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/video_player/video_player_platform_interface + video_player_platform_interface: ^3.0.0-nullsafety.1 dev_dependencies: flutter_test: From 57efa1db8a7d7709e11d7f0139122d3fbf526641 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:46:06 -0700 Subject: [PATCH 32/58] [video_player_web] Allow to publish --- packages/video_player/video_player_web/pubspec.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index b934df381035..6538bbcbed78 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -6,9 +6,6 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/v # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 version: 2.0.0-nullsafety -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - flutter: plugin: platforms: From 8b8edd0b11dfbfbf7cac6f3b89fa77313c401fc1 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 28 Oct 2020 10:48:31 -0700 Subject: [PATCH 33/58] [video_player] Fix pubspec --- packages/video_player/video_player/pubspec.yaml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index 15465cfef68a..ee9c9fe0bda6 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -7,9 +7,6 @@ description: Flutter plugin for displaying inline video with other Flutter version: 2.0.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player -# Don't publish this package until null safety is stable or the package is in the allow list. -publish_to: none - flutter: plugin: platforms: @@ -23,22 +20,14 @@ flutter: dependencies: meta: ^1.3.0-nullsafety.3 - video_player_platform_interface: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/video_player/video_player_platform_interface + video_player_platform_interface: ^3.0.0-nullsafety.1 # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish # validation, so we set a ^ constraint. # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - video_player_web: - git: - url: https://github.com/flutter/plugins.git - ref: nnbd - path: packages/video_player/video_player_web + video_player_web: ^2.0.0-nullsafety flutter: sdk: flutter From b69ac404fbdb8f47e0ea30a49b4b3610b4f499c1 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 4 Nov 2020 15:51:32 -0800 Subject: [PATCH 34/58] Bump SDK version --- packages/connectivity/connectivity/CHANGELOG.md | 4 ++++ packages/connectivity/connectivity/pubspec.yaml | 8 ++++---- .../connectivity_platform_interface/CHANGELOG.md | 4 ++++ .../connectivity_platform_interface/pubspec.yaml | 6 +++--- packages/device_info/device_info/CHANGELOG.md | 4 ++++ packages/device_info/device_info/pubspec.yaml | 4 ++-- .../device_info_platform_interface/CHANGELOG.md | 4 ++++ .../device_info_platform_interface/pubspec.yaml | 6 +++--- packages/plugin_platform_interface/CHANGELOG.md | 4 ++++ packages/plugin_platform_interface/pubspec.yaml | 4 ++-- packages/url_launcher/url_launcher/CHANGELOG.md | 4 ++++ packages/url_launcher/url_launcher/example/pubspec.yaml | 2 +- packages/url_launcher/url_launcher/pubspec.yaml | 6 +++--- packages/url_launcher/url_launcher_linux/CHANGELOG.md | 2 +- packages/url_launcher/url_launcher_linux/pubspec.yaml | 4 ++-- packages/url_launcher/url_launcher_macos/CHANGELOG.md | 4 ++++ packages/url_launcher/url_launcher_macos/pubspec.yaml | 4 ++-- .../url_launcher_platform_interface/CHANGELOG.md | 4 ++++ .../url_launcher_platform_interface/pubspec.yaml | 6 +++--- packages/url_launcher/url_launcher_windows/CHANGELOG.md | 4 ++++ packages/url_launcher/url_launcher_windows/pubspec.yaml | 4 ++-- packages/video_player/video_player/pubspec.yaml | 8 ++++---- .../video_player_platform_interface/CHANGELOG.md | 4 ++++ .../video_player_platform_interface/pubspec.yaml | 4 ++-- packages/video_player/video_player_web/CHANGELOG.md | 4 ++++ packages/video_player/video_player_web/pubspec.yaml | 4 ++-- 26 files changed, 80 insertions(+), 36 deletions(-) diff --git a/packages/connectivity/connectivity/CHANGELOG.md b/packages/connectivity/connectivity/CHANGELOG.md index cc6897be8637..76925c132acc 100644 --- a/packages/connectivity/connectivity/CHANGELOG.md +++ b/packages/connectivity/connectivity/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 3.0.0-nullsafety * Migrate to null safety. diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index 063b45edb836..a68ef36ca4cc 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -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: 3.0.0-nullsafety +version: 3.0.0-nullsafety.1 flutter: plugin: @@ -21,7 +21,7 @@ dependencies: flutter: sdk: flutter meta: ^1.0.5 - connectivity_platform_interface: 2.0.0-nullsafety + 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 @@ -36,9 +36,9 @@ dev_dependencies: integration_test: path: ../../integration_test mockito: ^4.1.1 - plugin_platform_interface: 1.1.0-nullsafety + plugin_platform_interface: 1.1.0-nullsafety.1 pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/connectivity/connectivity_platform_interface/CHANGELOG.md b/packages/connectivity/connectivity_platform_interface/CHANGELOG.md index dec275293ef9..39275bf7aa11 100644 --- a/packages/connectivity/connectivity_platform_interface/CHANGELOG.md +++ b/packages/connectivity/connectivity_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index f26107c5e9c0..f9b7c87dea43 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -3,13 +3,13 @@ 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: 2.0.0-nullsafety +version: 2.0.0-nullsafety.1 dependencies: flutter: sdk: flutter meta: ^1.3.0-nullsafety.3 - plugin_platform_interface: 1.1.0-nullsafety + plugin_platform_interface: 1.1.0-nullsafety.1 dev_dependencies: flutter_test: @@ -17,5 +17,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/device_info/device_info/CHANGELOG.md b/packages/device_info/device_info/CHANGELOG.md index 763fd9f425bb..74376095e159 100644 --- a/packages/device_info/device_info/CHANGELOG.md +++ b/packages/device_info/device_info/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index fed08f9bbae3..8c3831ba88eb 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 2.0.0-nullsafety +version: 2.0.0-nullsafety.1 flutter: plugin: @@ -19,7 +19,7 @@ flutter: dependencies: flutter: sdk: flutter - device_info_platform_interface: ^2.0.0-nullsafety + device_info_platform_interface: ^2.0.0-nullsafety.1 dev_dependencies: test: ^1.10.0-nullsafety.1 flutter_test: diff --git a/packages/device_info/device_info_platform_interface/CHANGELOG.md b/packages/device_info/device_info_platform_interface/CHANGELOG.md index fe9ded6b131f..c25b22e4b364 100644 --- a/packages/device_info/device_info_platform_interface/CHANGELOG.md +++ b/packages/device_info/device_info_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index d9c3264c4747..a52355feef86 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -3,13 +3,13 @@ description: A common platform interface for the device_info plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 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: 2.0.0-nullsafety +version: 2.0.0-nullsafety.1 dependencies: flutter: sdk: flutter meta: ^1.3.0-nullsafety.3 - plugin_platform_interface: 1.1.0-nullsafety + plugin_platform_interface: 1.1.0-nullsafety.1 dev_dependencies: flutter_test: @@ -18,5 +18,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' flutter: ">=1.9.1+hotfix.4 <2.0.0" diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index f8e848537c70..7df1834966dd 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 1.1.0-nullsafety * Migrate to null safety. diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index d79dbb8db3a6..66a3b6cc025e 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -12,12 +12,12 @@ description: Reusable base class for Flutter plugin platform interfaces. # be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version # that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: # `plugin_platform_interface: >=1.X.Y <3.0.0`). -version: 1.1.0-nullsafety +version: 1.1.0-nullsafety.1 repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' dependencies: meta: ^1.3.0-nullsafety.3 diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index 3b5fff1c9d25..dc4c4a6feb4a 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.0.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 6.0.0-nullsafety * Migrate to null safety. diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index 4a833f0f51d0..065c008936a4 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -14,7 +14,7 @@ dev_dependencies: sdk: flutter pedantic: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - plugin_platform_interface: 1.1.0-nullsafety + plugin_platform_interface: 1.1.0-nullsafety.1 flutter: uses-material-design: true diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 0ec7409a24af..104550c391f4 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher description: Flutter plugin for launching a URL on Android and iOS. Supports web, phone, SMS, and email schemes. homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher -version: 6.0.0-nullsafety +version: 6.0.0-nullsafety.1 flutter: plugin: @@ -42,9 +42,9 @@ dev_dependencies: sdk: flutter test: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - plugin_platform_interface: 1.1.0-nullsafety + plugin_platform_interface: 1.1.0-nullsafety.1 pedantic: ^1.10.0-nullsafety.1 environment: - sdk: ">=2.10.0-56.0.dev <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/url_launcher/url_launcher_linux/CHANGELOG.md b/packages/url_launcher/url_launcher_linux/CHANGELOG.md index c850ba8fa04e..8525e1f0d7a7 100644 --- a/packages/url_launcher/url_launcher_linux/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_linux/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.1.0-nullsafety +## 0.1.0-nullsafety.1 * Migrate to null safety. diff --git a/packages/url_launcher/url_launcher_linux/pubspec.yaml b/packages/url_launcher/url_launcher_linux/pubspec.yaml index e7ae1e89880d..3331a81ebaf3 100644 --- a/packages/url_launcher/url_launcher_linux/pubspec.yaml +++ b/packages/url_launcher/url_launcher_linux/pubspec.yaml @@ -1,6 +1,6 @@ name: url_launcher_linux description: Linux implementation of the url_launcher plugin. -version: 0.1.0-nullsafety +version: 0.1.0-nullsafety.1 homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_linux flutter: @@ -10,7 +10,7 @@ flutter: pluginClass: UrlLauncherPlugin environment: - sdk: ">=2.10.0-56.0.dev <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.8 <2.0.0" dependencies: diff --git a/packages/url_launcher/url_launcher_macos/CHANGELOG.md b/packages/url_launcher/url_launcher_macos/CHANGELOG.md index a43df4590ed0..a0e783b2ab02 100644 --- a/packages/url_launcher/url_launcher_macos/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_macos/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.1.0-nullsafety.1 + +* Bump SDK to support null safety. + # 0.1.0-nullsafety * Migrate to null safety. diff --git a/packages/url_launcher/url_launcher_macos/pubspec.yaml b/packages/url_launcher/url_launcher_macos/pubspec.yaml index 8c48c6d9d303..bcb958984e21 100644 --- a/packages/url_launcher/url_launcher_macos/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/pubspec.yaml @@ -3,7 +3,7 @@ description: macOS implementation of the url_launcher plugin. # 0.0.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.1.0-nullsafety +version: 0.1.0-nullsafety.1 homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_macos flutter: @@ -14,7 +14,7 @@ flutter: fileName: url_launcher_macos.dart environment: - sdk: ">=2.10.0-56.0.dev <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.8 <2.0.0" dependencies: diff --git a/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md b/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md index 74972e5307e1..5029848308b4 100644 --- a/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml index f5ea35db2491..2b5e67d463ff 100644 --- a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml +++ b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml @@ -3,12 +3,12 @@ description: A common platform interface for the url_launcher plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_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: 2.0.0-nullsafety +version: 2.0.0-nullsafety.1 dependencies: flutter: sdk: flutter - plugin_platform_interface: 1.1.0-nullsafety + plugin_platform_interface: 1.1.0-nullsafety.1 dev_dependencies: flutter_test: @@ -17,5 +17,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' flutter: ">=1.9.1+hotfix.4 <2.0.0" diff --git a/packages/url_launcher/url_launcher_windows/CHANGELOG.md b/packages/url_launcher/url_launcher_windows/CHANGELOG.md index a8748a3190f3..ef15cf2da89f 100644 --- a/packages/url_launcher/url_launcher_windows/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_windows/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 0.1.0-nullsafety * Migrate to null-safety. diff --git a/packages/url_launcher/url_launcher_windows/pubspec.yaml b/packages/url_launcher/url_launcher_windows/pubspec.yaml index 39ea2d2fb9b9..31ce992e9f54 100644 --- a/packages/url_launcher/url_launcher_windows/pubspec.yaml +++ b/packages/url_launcher/url_launcher_windows/pubspec.yaml @@ -3,7 +3,7 @@ description: Windows implementation of the url_launcher plugin. # 0.0.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.1.0-nullsafety +version: 0.1.0-nullsafety.1 homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_windows flutter: @@ -13,7 +13,7 @@ flutter: pluginClass: UrlLauncherPlugin environment: - sdk: ">=2.10.0-56.0.dev <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.8 <2.0.0" dependencies: diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index cfefaad6074c..6e40db7e6292 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter # 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 2.0.0-nullsafety.1 +version: 2.0.0-nullsafety.2 homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player flutter: @@ -20,14 +20,14 @@ flutter: dependencies: meta: ^1.3.0-nullsafety.3 - video_player_platform_interface: ^3.0.0-nullsafety.1 + video_player_platform_interface: ^3.0.0-nullsafety.2 # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish # validation, so we set a ^ constraint. # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - video_player_web: ^2.0.0-nullsafety + video_player_web: ^2.0.0-nullsafety.1 flutter: sdk: flutter @@ -39,5 +39,5 @@ dev_dependencies: pigeon: 0.1.7 environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/video_player/video_player_platform_interface/CHANGELOG.md b/packages/video_player/video_player_platform_interface/CHANGELOG.md index 1522d2be478b..880f818d100d 100644 --- a/packages/video_player/video_player_platform_interface/CHANGELOG.md +++ b/packages/video_player/video_player_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.0-nullsafety.2 + +* Bump Dart SDK to support null safety. + ## 3.0.0-nullsafety.1 * Make DataSource's `uri` parameter nullable. diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml index 7394a3391952..77137239448f 100644 --- a/packages/video_player/video_player_platform_interface/pubspec.yaml +++ b/packages/video_player/video_player_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the video_player plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_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: 3.0.0-nullsafety.1 +version: 3.0.0-nullsafety.2 dependencies: flutter: @@ -17,5 +17,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: ">=2.10.0-56.0.dev <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.10.0 <2.0.0" diff --git a/packages/video_player/video_player_web/CHANGELOG.md b/packages/video_player/video_player_web/CHANGELOG.md index d0358100e9da..6b38dbd5b8cb 100644 --- a/packages/video_player/video_player_web/CHANGELOG.md +++ b/packages/video_player/video_player_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.1 + +* Bump Dart SDK to support null safety. + ## 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index 6538bbcbed78..098c9f5b95f7 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/v # 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 2.0.0-nullsafety +version: 2.0.0-nullsafety.1 flutter: plugin: @@ -29,5 +29,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' flutter: ">=1.12.13+hotfix.5 <2.0.0" From 0f6a1becdf98b7ba4420784eb60248521d90af6f Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 4 Nov 2020 16:01:00 -0800 Subject: [PATCH 35/58] [device_info] Bump SDK --- packages/device_info/device_info/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index 8c3831ba88eb..03610ffb2e90 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -27,5 +27,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.10.0-56.0.dev <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' flutter: ">=1.12.13+hotfix.5 <2.0.0" From f9529b2437b26225cf2431e12faaa99a56d138fd Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Fri, 6 Nov 2020 11:42:10 -0800 Subject: [PATCH 36/58] [Path Provider] Migrate platform interface to nnbd (#3249) --- .../CHANGELOG.md | 8 ++++++ .../lib/path_provider_platform_interface.dart | 18 ++++++------ .../lib/src/method_channel_path_provider.dart | 18 ++++++------ .../pubspec.yaml | 13 ++++----- .../method_channel_path_provider_test.dart | 28 ++++++++++--------- 5 files changed, 47 insertions(+), 38 deletions(-) diff --git a/packages/path_provider/path_provider_platform_interface/CHANGELOG.md b/packages/path_provider/path_provider_platform_interface/CHANGELOG.md index 23f71c99a678..8666a7ee6715 100644 --- a/packages/path_provider/path_provider_platform_interface/CHANGELOG.md +++ b/packages/path_provider/path_provider_platform_interface/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.0.0-nullsafety + +* Migrate to null safety. + +## 1.0.4 + +* Remove unused `test` dependency. + ## 1.0.3 * Increase upper range of `package:platform` constraint to allow 3.X versions. diff --git a/packages/path_provider/path_provider_platform_interface/lib/path_provider_platform_interface.dart b/packages/path_provider/path_provider_platform_interface/lib/path_provider_platform_interface.dart index 4f796aaeec33..1ff2a978c5a4 100644 --- a/packages/path_provider/path_provider_platform_interface/lib/path_provider_platform_interface.dart +++ b/packages/path_provider/path_provider_platform_interface/lib/path_provider_platform_interface.dart @@ -40,26 +40,26 @@ abstract class PathProviderPlatform extends PlatformInterface { /// Path to the temporary directory on the device that is not backed up and is /// suitable for storing caches of downloaded files. - Future getTemporaryPath() { + Future getTemporaryPath() { throw UnimplementedError('getTemporaryPath() has not been implemented.'); } /// Path to a directory where the application may place application support /// files. - Future getApplicationSupportPath() { + Future getApplicationSupportPath() { throw UnimplementedError( 'getApplicationSupportPath() has not been implemented.'); } /// Path to the directory where application can store files that are persistent, /// backed up, and not visible to the user, such as sqlite.db. - Future getLibraryPath() { + Future getLibraryPath() { throw UnimplementedError('getLibraryPath() has not been implemented.'); } /// Path to a directory where the application may place data that is /// user-generated, or that cannot otherwise be recreated by your application. - Future getApplicationDocumentsPath() { + Future getApplicationDocumentsPath() { throw UnimplementedError( 'getApplicationDocumentsPath() has not been implemented.'); } @@ -67,7 +67,7 @@ abstract class PathProviderPlatform extends PlatformInterface { /// Path to a directory where the application may access top level storage. /// The current operating system should be determined before issuing this /// function call, as this functionality is only available on Android. - Future getExternalStoragePath() { + Future getExternalStoragePath() { throw UnimplementedError( 'getExternalStoragePath() has not been implemented.'); } @@ -76,7 +76,7 @@ abstract class PathProviderPlatform extends PlatformInterface { /// stored. These paths typically reside on external storage like separate /// partitions or SD cards. Phones may have multiple storage directories /// available. - Future> getExternalCachePaths() { + Future?> getExternalCachePaths() { throw UnimplementedError( 'getExternalCachePaths() has not been implemented.'); } @@ -84,10 +84,10 @@ abstract class PathProviderPlatform extends PlatformInterface { /// Paths to directories where application specific data can be stored. /// These paths typically reside on external storage like separate partitions /// or SD cards. Phones may have multiple storage directories available. - Future> getExternalStoragePaths({ + Future?> getExternalStoragePaths({ /// Optional parameter. See [StorageDirectory] for more informations on /// how this type translates to Android storage directories. - StorageDirectory type, + StorageDirectory? type, }) { throw UnimplementedError( 'getExternalStoragePaths() has not been implemented.'); @@ -95,7 +95,7 @@ abstract class PathProviderPlatform extends PlatformInterface { /// Path to the directory where downloaded files can be stored. /// This is typically only relevant on desktop operating systems. - Future getDownloadsPath() { + Future getDownloadsPath() { throw UnimplementedError('getDownloadsPath() has not been implemented.'); } } diff --git a/packages/path_provider/path_provider_platform_interface/lib/src/method_channel_path_provider.dart b/packages/path_provider/path_provider_platform_interface/lib/src/method_channel_path_provider.dart index 7826fa4365be..728c1068f876 100644 --- a/packages/path_provider/path_provider_platform_interface/lib/src/method_channel_path_provider.dart +++ b/packages/path_provider/path_provider_platform_interface/lib/src/method_channel_path_provider.dart @@ -30,34 +30,34 @@ class MethodChannelPathProvider extends PathProviderPlatform { _platform = platform; } - Future getTemporaryPath() { + Future getTemporaryPath() { return methodChannel.invokeMethod('getTemporaryDirectory'); } - Future getApplicationSupportPath() { + Future getApplicationSupportPath() { return methodChannel.invokeMethod('getApplicationSupportDirectory'); } - Future getLibraryPath() { + Future getLibraryPath() { if (!_platform.isIOS && !_platform.isMacOS) { throw UnsupportedError('Functionality only available on iOS/macOS'); } return methodChannel.invokeMethod('getLibraryDirectory'); } - Future getApplicationDocumentsPath() { + Future getApplicationDocumentsPath() { return methodChannel .invokeMethod('getApplicationDocumentsDirectory'); } - Future getExternalStoragePath() { + Future getExternalStoragePath() { if (!_platform.isAndroid) { throw UnsupportedError('Functionality only available on Android'); } return methodChannel.invokeMethod('getStorageDirectory'); } - Future> getExternalCachePaths() { + Future?> getExternalCachePaths() { if (!_platform.isAndroid) { throw UnsupportedError('Functionality only available on Android'); } @@ -65,8 +65,8 @@ class MethodChannelPathProvider extends PathProviderPlatform { .invokeListMethod('getExternalCacheDirectories'); } - Future> getExternalStoragePaths({ - StorageDirectory type, + Future?> getExternalStoragePaths({ + StorageDirectory? type, }) async { if (!_platform.isAndroid) { throw UnsupportedError('Functionality only available on Android'); @@ -77,7 +77,7 @@ class MethodChannelPathProvider extends PathProviderPlatform { ); } - Future getDownloadsPath() { + Future getDownloadsPath() { if (!_platform.isMacOS) { throw UnsupportedError('Functionality only available on macOS'); } diff --git a/packages/path_provider/path_provider_platform_interface/pubspec.yaml b/packages/path_provider/path_provider_platform_interface/pubspec.yaml index 9f1293883826..5587c0d7f210 100644 --- a/packages/path_provider/path_provider_platform_interface/pubspec.yaml +++ b/packages/path_provider/path_provider_platform_interface/pubspec.yaml @@ -3,21 +3,20 @@ description: A common platform interface for the path_provider plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_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.3 +version: 2.0.0-nullsafety dependencies: flutter: sdk: flutter - meta: ^1.0.5 + meta: ^1.3.0-nullsafety.3 platform: ">=2.0.0 <4.0.0" - plugin_platform_interface: ^1.0.1 + plugin_platform_interface: 1.1.0-nullsafety dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.8.0 - test: any + pedantic: ^1.10.0-nullsafety.1 environment: - sdk: ">=2.1.0 <3.0.0" - flutter: ">=1.10.0 <2.0.0" + sdk: ">=2.12.0-0 <3.0.0" + flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart b/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart index 99c9349f9ae5..7130d7743e69 100644 --- a/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart +++ b/packages/path_provider/path_provider_platform_interface/test/method_channel_path_provider_test.dart @@ -19,7 +19,7 @@ void main() { const String kDownloadsPath = 'downloadsPath'; group('$MethodChannelPathProvider', () { - MethodChannelPathProvider methodChannelPathProvider; + late MethodChannelPathProvider methodChannelPathProvider; final List log = []; setUp(() async { @@ -59,7 +59,7 @@ void main() { }); test('getTemporaryPath', () async { - final String path = await methodChannelPathProvider.getTemporaryPath(); + final String? path = await methodChannelPathProvider.getTemporaryPath(); expect( log, [isMethodCall('getTemporaryDirectory', arguments: null)], @@ -68,7 +68,7 @@ void main() { }); test('getApplicationSupportPath', () async { - final String path = + final String? path = await methodChannelPathProvider.getApplicationSupportPath(); expect( log, @@ -92,7 +92,7 @@ void main() { methodChannelPathProvider .setMockPathProviderPlatform(FakePlatform(operatingSystem: 'ios')); - final String path = await methodChannelPathProvider.getLibraryPath(); + final String? path = await methodChannelPathProvider.getLibraryPath(); expect( log, [isMethodCall('getLibraryDirectory', arguments: null)], @@ -104,7 +104,7 @@ void main() { methodChannelPathProvider .setMockPathProviderPlatform(FakePlatform(operatingSystem: 'macos')); - final String path = await methodChannelPathProvider.getLibraryPath(); + final String? path = await methodChannelPathProvider.getLibraryPath(); expect( log, [isMethodCall('getLibraryDirectory', arguments: null)], @@ -113,7 +113,7 @@ void main() { }); test('getApplicationDocumentsPath', () async { - final String path = + final String? path = await methodChannelPathProvider.getApplicationDocumentsPath(); expect( log, @@ -125,13 +125,13 @@ void main() { }); test('getExternalCachePaths android succeeds', () async { - final List result = + final List? result = await methodChannelPathProvider.getExternalCachePaths(); expect( log, [isMethodCall('getExternalCacheDirectories', arguments: null)], ); - expect(result.length, 1); + expect(result!.length, 1); expect(result.first, kExternalCachePaths); }); @@ -147,10 +147,12 @@ void main() { } }); - for (StorageDirectory type - in StorageDirectory.values + [null]) { + for (StorageDirectory? type in [ + null, + ...StorageDirectory.values + ]) { test('getExternalStoragePaths (type: $type) android succeeds', () async { - final List result = + final List? result = await methodChannelPathProvider.getExternalStoragePaths(type: type); expect( log, @@ -162,7 +164,7 @@ void main() { ], ); - expect(result.length, 1); + expect(result!.length, 1); expect(result.first, kExternalStoragePaths); }); @@ -182,7 +184,7 @@ void main() { test('getDownloadsPath macos succeeds', () async { methodChannelPathProvider .setMockPathProviderPlatform(FakePlatform(operatingSystem: 'macos')); - final String result = await methodChannelPathProvider.getDownloadsPath(); + final String? result = await methodChannelPathProvider.getDownloadsPath(); expect( log, [isMethodCall('getDownloadsDirectory', arguments: null)], From 3a273d8f69663c4de607c0e9c3ec466e585a67c7 Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Fri, 6 Nov 2020 17:43:31 -0800 Subject: [PATCH 37/58] [local_auth] Migrate to null safety. (#3255) --- packages/local_auth/CHANGELOG.md | 4 ++++ packages/local_auth/lib/auth_strings.dart | 24 +++++++++---------- packages/local_auth/lib/local_auth.dart | 23 ++++++++++-------- packages/local_auth/pubspec.yaml | 10 ++++---- packages/local_auth/test/local_auth_test.dart | 2 +- 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/packages/local_auth/CHANGELOG.md b/packages/local_auth/CHANGELOG.md index 57295ab32012..c8452d7d2b17 100644 --- a/packages/local_auth/CHANGELOG.md +++ b/packages/local_auth/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.0-nullsafety + +* Migrate to null safety. + ## 0.6.3+3 * Update android compileSdkVersion to 29. diff --git a/packages/local_auth/lib/auth_strings.dart b/packages/local_auth/lib/auth_strings.dart index a8f34f88723c..3afc23827d98 100644 --- a/packages/local_auth/lib/auth_strings.dart +++ b/packages/local_auth/lib/auth_strings.dart @@ -25,14 +25,14 @@ class AndroidAuthMessages { this.goToSettingsDescription, }); - final String fingerprintHint; - final String fingerprintNotRecognized; - final String fingerprintSuccess; - final String cancelButton; - final String signInTitle; - final String fingerprintRequiredTitle; - final String goToSettingsButton; - final String goToSettingsDescription; + final String? fingerprintHint; + final String? fingerprintNotRecognized; + final String? fingerprintSuccess; + final String? cancelButton; + final String? signInTitle; + final String? fingerprintRequiredTitle; + final String? goToSettingsButton; + final String? goToSettingsDescription; Map get args { return { @@ -62,10 +62,10 @@ class IOSAuthMessages { this.cancelButton, }); - final String lockOut; - final String goToSettingsButton; - final String goToSettingsDescription; - final String cancelButton; + final String? lockOut; + final String? goToSettingsButton; + final String? goToSettingsDescription; + final String? cancelButton; Map get args { return { diff --git a/packages/local_auth/lib/local_auth.dart b/packages/local_auth/lib/local_auth.dart index b2b03b920d64..f1dbdd4840a8 100644 --- a/packages/local_auth/lib/local_auth.dart +++ b/packages/local_auth/lib/local_auth.dart @@ -67,7 +67,7 @@ class LocalAuthentication { /// [PlatformException] with error code [otherOperatingSystem] on the iOS /// simulator. Future authenticateWithBiometrics({ - @required String localizedReason, + required String localizedReason, bool useErrorDialogs = true, bool stickyAuth = false, AndroidAuthMessages androidAuthStrings = const AndroidAuthMessages(), @@ -92,8 +92,9 @@ class LocalAuthentication { 'operating systems.', details: 'Your operating system is ${_platform.operatingSystem}'); } - return await _channel.invokeMethod( - 'authenticateWithBiometrics', args); + final bool? result = + await _channel.invokeMethod('authenticateWithBiometrics', args); + return result!; } /// Returns true if auth was cancelled successfully. @@ -101,18 +102,20 @@ class LocalAuthentication { /// Returns false if there was some error or no auth in progress. /// /// Returns [Future] bool true or false: - Future stopAuthentication() { + Future stopAuthentication() async { if (_platform.isAndroid) { - return _channel.invokeMethod('stopAuthentication'); + final bool? result = + await _channel.invokeMethod('stopAuthentication'); + return result!; } - return Future.sync(() => true); + return true; } /// Returns true if device is capable of checking biometrics /// /// Returns a [Future] bool true or false: Future get canCheckBiometrics async => - (await _channel.invokeListMethod('getAvailableBiometrics')) + (await _channel.invokeListMethod('getAvailableBiometrics'))! .isNotEmpty; /// Returns a list of enrolled biometrics @@ -122,10 +125,10 @@ class LocalAuthentication { /// - BiometricType.fingerprint /// - BiometricType.iris (not yet implemented) Future> getAvailableBiometrics() async { - final List result = - (await _channel.invokeListMethod('getAvailableBiometrics')); + final List? result = + await _channel.invokeListMethod('getAvailableBiometrics'); final List biometrics = []; - result.forEach((String value) { + result!.forEach((String value) { switch (value) { case 'face': biometrics.add(BiometricType.face); diff --git a/packages/local_auth/pubspec.yaml b/packages/local_auth/pubspec.yaml index 9505c774e24d..0547ad19f496 100644 --- a/packages/local_auth/pubspec.yaml +++ b/packages/local_auth/pubspec.yaml @@ -2,7 +2,7 @@ name: local_auth description: Flutter plugin for Android and iOS device authentication sensors such as Fingerprint Reader and Touch ID. homepage: https://github.com/flutter/plugins/tree/master/packages/local_auth -version: 0.6.3+3 +version: 1.0.0-nullsafety flutter: plugin: @@ -16,8 +16,8 @@ flutter: dependencies: flutter: sdk: flutter - meta: ^1.0.5 - intl: ">=0.15.1 <0.17.0" + meta: ^1.3.0-nullsafety.3 + intl: ^0.17.0-nullsafety.2 platform: ">=2.0.0 <4.0.0" flutter_plugin_android_lifecycle: ^1.0.2 @@ -28,8 +28,8 @@ dev_dependencies: sdk: flutter 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 <2.0.0" diff --git a/packages/local_auth/test/local_auth_test.dart b/packages/local_auth/test/local_auth_test.dart index 205c5f785708..52b8dbf21f72 100644 --- a/packages/local_auth/test/local_auth_test.dart +++ b/packages/local_auth/test/local_auth_test.dart @@ -19,7 +19,7 @@ void main() { ); final List log = []; - LocalAuthentication localAuthentication; + late LocalAuthentication localAuthentication; setUp(() { channel.setMockMethodCallHandler((MethodCall methodCall) { From e62de470ab824fbd9b01918820a74f9f5a7b6eee Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 17 Nov 2020 20:05:15 -0800 Subject: [PATCH 38/58] [device_info_platform_interface] Remove default types and correct nullable types (#3269) --- .../CHANGELOG.md | 5 + .../lib/model/android_device_info.dart | 81 ++++++------ .../lib/model/ios_device_info.dart | 25 ++-- .../pubspec.yaml | 2 +- .../test/method_channel_device_info_test.dart | 119 +++++++++++++++++- 5 files changed, 175 insertions(+), 57 deletions(-) diff --git a/packages/device_info/device_info_platform_interface/CHANGELOG.md b/packages/device_info/device_info_platform_interface/CHANGELOG.md index c25b22e4b364..5e0c3d6dc713 100644 --- a/packages/device_info/device_info_platform_interface/CHANGELOG.md +++ b/packages/device_info/device_info_platform_interface/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.0-nullsafety.2 + +* Make `baseOS`, `previewSdkInt`, and `securityPatch` nullable types. +* Remove default values for non-nullable types. + ## 2.0.0-nullsafety.1 * Bump Dart SDK to support null safety. diff --git a/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart b/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart index ea5839da14d3..4fb940c3effa 100644 --- a/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart +++ b/packages/device_info/device_info_platform_interface/lib/model/android_device_info.dart @@ -113,28 +113,28 @@ class AndroidDeviceInfo { /// Deserializes from the message received from [_kChannel]. static AndroidDeviceInfo fromMap(Map map) { return AndroidDeviceInfo( - version: AndroidBuildVersion._fromMap( - map['version']?.cast() ?? {}), - board: map['board'] ?? '', - bootloader: map['bootloader'] ?? '', - brand: map['brand'] ?? '', - device: map['device'] ?? '', - display: map['display'] ?? '', - fingerprint: map['fingerprint'] ?? '', - hardware: map['hardware'] ?? '', - host: map['host'] ?? '', - id: map['id'] ?? '', - manufacturer: map['manufacturer'] ?? '', - model: map['model'] ?? '', - product: map['product'] ?? '', - supported32BitAbis: _fromList(map['supported32BitAbis'] ?? []), - supported64BitAbis: _fromList(map['supported64BitAbis'] ?? []), - supportedAbis: _fromList(map['supportedAbis'] ?? []), - tags: map['tags'] ?? '', - type: map['type'] ?? '', - isPhysicalDevice: map['isPhysicalDevice'] ?? false, - androidId: map['androidId'] ?? '', - systemFeatures: _fromList(map['systemFeatures'] ?? []), + version: + AndroidBuildVersion._fromMap(map['version']!.cast()), + board: map['board']!, + bootloader: map['bootloader']!, + brand: map['brand']!, + device: map['device']!, + display: map['display']!, + fingerprint: map['fingerprint']!, + hardware: map['hardware']!, + host: map['host']!, + id: map['id']!, + manufacturer: map['manufacturer']!, + model: map['model']!, + product: map['product']!, + supported32BitAbis: _fromList(map['supported32BitAbis']!), + supported64BitAbis: _fromList(map['supported64BitAbis']!), + supportedAbis: _fromList(map['supportedAbis']!), + tags: map['tags']!, + type: map['type']!, + isPhysicalDevice: map['isPhysicalDevice']!, + androidId: map['androidId']!, + systemFeatures: _fromList(map['systemFeatures']!), ); } @@ -151,17 +151,26 @@ class AndroidDeviceInfo { /// See: https://developer.android.com/reference/android/os/Build.VERSION.html class AndroidBuildVersion { AndroidBuildVersion._({ - required this.baseOS, + this.baseOS, + this.previewSdkInt, + this.securityPatch, required this.codename, required this.incremental, - required this.previewSdkInt, required this.release, required this.sdkInt, - required this.securityPatch, }); /// The base OS build the product is based on. - final String baseOS; + /// This is only available on Android 6.0 or above. + String? baseOS; + + /// The developer preview revision of a prerelease SDK. + /// This is only available on Android 6.0 or above. + int? previewSdkInt; + + /// The user-visible security patch level. + /// This is only available on Android 6.0 or above. + final String? securityPatch; /// The current development codename, or the string "REL" if this is a release build. final String codename; @@ -169,9 +178,6 @@ class AndroidBuildVersion { /// The internal value used by the underlying source control to represent this build. final String incremental; - /// The developer preview revision of a prerelease SDK. - final int previewSdkInt; - /// The user-visible version string. final String release; @@ -180,19 +186,16 @@ class AndroidBuildVersion { /// Possible values are defined in: https://developer.android.com/reference/android/os/Build.VERSION_CODES.html final int sdkInt; - /// The user-visible security patch level. - final String securityPatch; - /// Deserializes from the map message received from [_kChannel]. static AndroidBuildVersion _fromMap(Map map) { return AndroidBuildVersion._( - baseOS: map['baseOS'] ?? '', - codename: map['codename'] ?? '', - incremental: map['incremental'] ?? '', - previewSdkInt: map['previewSdkInt'] ?? 0, - release: map['release'] ?? '', - sdkInt: map['sdkInt'] ?? 0, - securityPatch: map['securityPatch'] ?? '', + baseOS: map['baseOS'], + previewSdkInt: map['previewSdkInt'], + securityPatch: map['securityPatch'], + codename: map['codename']!, + incremental: map['incremental']!, + release: map['release']!, + sdkInt: map['sdkInt']!, ); } } diff --git a/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart b/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart index f909fadd20ae..eb6e5874073b 100644 --- a/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart +++ b/packages/device_info/device_info_platform_interface/lib/model/ios_device_info.dart @@ -45,15 +45,14 @@ class IosDeviceInfo { /// Deserializes from the map message received from [_kChannel]. static IosDeviceInfo fromMap(Map map) { return IosDeviceInfo( - name: map['name'] ?? '', - systemName: map['systemName'] ?? '', - systemVersion: map['systemVersion'] ?? '', - model: map['model'] ?? '', - localizedModel: map['localizedModel'] ?? '', - identifierForVendor: map['identifierForVendor'] ?? '', + name: map['name']!, + systemName: map['systemName']!, + systemVersion: map['systemVersion']!, + model: map['model']!, + localizedModel: map['localizedModel']!, + identifierForVendor: map['identifierForVendor']!, isPhysicalDevice: map['isPhysicalDevice'] == 'true', - utsname: - IosUtsname._fromMap(map['utsname']?.cast() ?? {}), + utsname: IosUtsname._fromMap(map['utsname']!.cast()), ); } } @@ -87,11 +86,11 @@ class IosUtsname { /// Deserializes from the map message received from [_kChannel]. static IosUtsname _fromMap(Map map) { return IosUtsname._( - sysname: map['sysname'] ?? '', - nodename: map['nodename'] ?? '', - release: map['release'] ?? '', - version: map['version'] ?? '', - machine: map['machine'] ?? '', + sysname: map['sysname']!, + nodename: map['nodename']!, + release: map['release']!, + version: map['version']!, + machine: map['machine']!, ); } } diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index a52355feef86..3e8ce64633e9 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the device_info plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 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: 2.0.0-nullsafety.1 +version: 2.0.0-nullsafety.2 dependencies: flutter: diff --git a/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart b/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart index 0a1ba7042a4a..15963854ab12 100644 --- a/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart +++ b/packages/device_info/device_info_platform_interface/test/method_channel_device_info_test.dart @@ -24,11 +24,68 @@ void main() { switch (methodCall.method) { case 'getAndroidDeviceInfo': return ({ - "brand": "Google", + "version": { + "securityPatch": "2018-09-05", + "sdkInt": 28, + "release": "9", + "previewSdkInt": 0, + "incremental": "5124027", + "codename": "REL", + "baseOS": "", + }, + "board": "goldfish_x86_64", + "bootloader": "unknown", + "brand": "google", + "device": "generic_x86_64", + "display": "PSR1.180720.075", + "fingerprint": + "google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:user/release-keys", + "hardware": "ranchu", + "host": "abfarm730", + "id": "PSR1.180720.075", + "manufacturer": "Google", + "model": "Android SDK built for x86_64", + "product": "sdk_gphone_x86_64", + "supported32BitAbis": [ + "x86", + ], + "supported64BitAbis": [ + "x86_64", + ], + "supportedAbis": [ + "x86_64", + "x86", + ], + "tags": "release-keys", + "type": "user", + "isPhysicalDevice": false, + "androidId": "f47571f3b4648f45", + "systemFeatures": [ + "android.hardware.sensor.proximity", + "android.software.adoptable_storage", + "android.hardware.sensor.accelerometer", + "android.hardware.faketouch", + "android.software.backup", + "android.hardware.touchscreen", + ], }); case 'getIosDeviceInfo': return ({ - "name": "iPhone 10", + "name": "iPhone 13", + "systemName": "iOS", + "systemVersion": "13.0", + "model": "iPhone", + "localizedModel": "iPhone", + "identifierForVendor": "88F59280-55AD-402C-B922-3203B4794C06", + "isPhysicalDevice": false, + "utsname": { + "sysname": "Darwin", + "nodename": "host", + "release": "19.6.0", + "version": + "Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64", + "machine": "x86_64", + } }); default: return null; @@ -39,12 +96,66 @@ void main() { test("androidInfo", () async { final AndroidDeviceInfo result = await methodChannelDeviceInfo.androidInfo(); - expect(result.brand, "Google"); + + expect(result.version.securityPatch, "2018-09-05"); + expect(result.version.sdkInt, 28); + expect(result.version.release, "9"); + expect(result.version.previewSdkInt, 0); + expect(result.version.incremental, "5124027"); + expect(result.version.codename, "REL"); + expect(result.board, "goldfish_x86_64"); + expect(result.bootloader, "unknown"); + expect(result.brand, "google"); + expect(result.device, "generic_x86_64"); + expect(result.display, "PSR1.180720.075"); + expect(result.fingerprint, + "google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:user/release-keys"); + expect(result.hardware, "ranchu"); + expect(result.host, "abfarm730"); + expect(result.id, "PSR1.180720.075"); + expect(result.manufacturer, "Google"); + expect(result.model, "Android SDK built for x86_64"); + expect(result.product, "sdk_gphone_x86_64"); + expect(result.supported32BitAbis, [ + "x86", + ]); + expect(result.supported64BitAbis, [ + "x86_64", + ]); + expect(result.supportedAbis, [ + "x86_64", + "x86", + ]); + expect(result.tags, "release-keys"); + expect(result.type, "user"); + expect(result.isPhysicalDevice, false); + expect(result.androidId, "f47571f3b4648f45"); + expect(result.systemFeatures, [ + "android.hardware.sensor.proximity", + "android.software.adoptable_storage", + "android.hardware.sensor.accelerometer", + "android.hardware.faketouch", + "android.software.backup", + "android.hardware.touchscreen", + ]); }); test("iosInfo", () async { final IosDeviceInfo result = await methodChannelDeviceInfo.iosInfo(); - expect(result.name, "iPhone 10"); + expect(result.name, "iPhone 13"); + expect(result.systemName, "iOS"); + expect(result.systemVersion, "13.0"); + expect(result.model, "iPhone"); + expect(result.localizedModel, "iPhone"); + expect( + result.identifierForVendor, "88F59280-55AD-402C-B922-3203B4794C06"); + expect(result.isPhysicalDevice, false); + expect(result.utsname.sysname, "Darwin"); + expect(result.utsname.nodename, "host"); + expect(result.utsname.release, "19.6.0"); + expect(result.utsname.version, + "Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64"); + expect(result.utsname.machine, "x86_64"); }); }); } From a9e538adc6ac0364aae88f80d77147b25fc5b6fe Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 1 Dec 2020 16:06:43 -0800 Subject: [PATCH 39/58] [video_player] Dart requires null safety 2.12 --- packages/video_player/video_player/CHANGELOG.md | 4 ++++ .../video_player_platform_interface/lib/messages.dart | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md index 36d5132db823..002a60ff9c2a 100644 --- a/packages/video_player/video_player/CHANGELOG.md +++ b/packages/video_player/video_player/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.2 + +* Dart null safety requires `2.12`. + ## 2.0.0-nullsafety.1 * Merge master. diff --git a/packages/video_player/video_player_platform_interface/lib/messages.dart b/packages/video_player/video_player_platform_interface/lib/messages.dart index 5faf6fb6d048..252cad6993ca 100644 --- a/packages/video_player/video_player_platform_interface/lib/messages.dart +++ b/packages/video_player/video_player_platform_interface/lib/messages.dart @@ -1,7 +1,7 @@ // Autogenerated from Pigeon (v0.1.12), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import -// @dart = 2.10 +// @dart = 2.12 import 'dart:async'; import 'package:flutter/services.dart'; import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; From 7764b757ec9f0f7c9d531c58d54ad4768e8753ed Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 1 Dec 2020 16:12:43 -0800 Subject: [PATCH 40/58] [video_player] Fix CHANGELOG/pubspec --- .../device_info/device_info_platform_interface/pubspec.yaml | 2 +- packages/video_player/video_player/CHANGELOG.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 3e8ce64633e9..4da53cf6358c 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the device_info plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 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: 2.0.0-nullsafety.2 +version: 2.0.0-nullsafety.3 dependencies: flutter: diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md index 002a60ff9c2a..06c623f12b2e 100644 --- a/packages/video_player/video_player/CHANGELOG.md +++ b/packages/video_player/video_player/CHANGELOG.md @@ -1,7 +1,11 @@ -## 2.0.0-nullsafety.2 +## 2.0.0-nullsafety.3 * Dart null safety requires `2.12`. +## 2.0.0-nullsafety.2 + +* Bump SDK version. + ## 2.0.0-nullsafety.1 * Merge master. From 254f4c61484850dc12d6f04351770ae63803f5cb Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 1 Dec 2020 16:15:59 -0800 Subject: [PATCH 41/58] [video_player] Fix mistake --- .../device_info/device_info_platform_interface/pubspec.yaml | 2 +- packages/video_player/video_player/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 4da53cf6358c..3e8ce64633e9 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the device_info plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/device_info # 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: 2.0.0-nullsafety.3 +version: 2.0.0-nullsafety.2 dependencies: flutter: diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index 6e40db7e6292..1c40cf0d6edf 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter # 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 2.0.0-nullsafety.2 +version: 2.0.0-nullsafety.3 homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player flutter: From 9a92712ae72a2f65c207e9b8e136fdddc99efa1a Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 1 Dec 2020 18:25:04 -0800 Subject: [PATCH 42/58] [video_player] remove null! --- packages/video_player/video_player/test/video_player_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player/test/video_player_test.dart b/packages/video_player/video_player/test/video_player_test.dart index d9701ba5b21e..3e9800f2b68e 100644 --- a/packages/video_player/video_player/test/video_player_test.dart +++ b/packages/video_player/video_player/test/video_player_test.dart @@ -33,7 +33,7 @@ class FakeController extends ValueNotifier DataSourceType get dataSourceType => DataSourceType.file; @override - String get package => null!; + String get package => ''; @override Future get position async => value.position; From b8b6a6e8544c74a1e8d6f401d65dd947da400bc9 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 14:45:12 -0800 Subject: [PATCH 43/58] Remove enable-experiment --- .cirrus.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 49003bdb7cb6..98cd6276e0e6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -37,7 +37,7 @@ task: # https://github.com/flutter/flutter/issues/42864 - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - - ./script/incremental_build.sh test --enable-experiment=non-nullable + - ./script/incremental_build.sh test - name: analyze script: ./script/incremental_build.sh analyze - name: build_all_plugins_apk @@ -87,13 +87,13 @@ task: - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt - export CIRRUS_CHANGE_MESSAGE="" - export CIRRUS_COMMIT_MESSAGE="" - - ./script/incremental_build.sh build-examples --apk --enable-experiment=non-nullable + - ./script/incremental_build.sh build-examples --apk - ./script/incremental_build.sh java-test # must come after apk build - if [[ $GCLOUD_FIREBASE_TESTLAB_KEY == ENCRYPTED* ]]; then - echo "This user does not have permission to run Firebase Test Lab tests." - else - echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json - - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 --enable-experiment=non-nullable + - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 - fi - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` @@ -178,9 +178,9 @@ task: # https://github.com/flutter/flutter/issues/42864 - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - - ./script/incremental_build.sh build-examples --ipa --enable-experiment=non-nullable - - ./script/incremental_build.sh drive-examples --enable-experiment=non-nullable - - ./script/incremental_build.sh xctest --target RunnerUITests --skip $PLUGINS_TO_SKIP_XCTESTS --enable-experiment=non-nullable + - ./script/incremental_build.sh build-examples --ipa + - ./script/incremental_build.sh drive-examples + - ./script/incremental_build.sh xctest --target RunnerUITests --skip $PLUGINS_TO_SKIP_XCTESTS task: # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins only_if: $CIRRUS_TAG == '' From 76b9d4c5b46e1e5aafd975e49e151389ccd0971d Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 15:09:22 -0800 Subject: [PATCH 44/58] Add skip list --- script/nnbd_plugins.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script/nnbd_plugins.sh b/script/nnbd_plugins.sh index 5d167d7b5da6..dc82e2596e79 100644 --- a/script/nnbd_plugins.sh +++ b/script/nnbd_plugins.sh @@ -5,7 +5,15 @@ # null-safe is available on stable. readonly NNBD_PLUGINS_LIST=( + "connectivity" + "device_info" "flutter_webview" + "google_sign_in" + "local_auth" + "path_provider" + "plugin_platform_interface" + "url_launcher" + "video_player" ) export EXCLUDED_PLUGINS_FROM_STABLE=$(IFS=, ; echo "${NNBD_PLUGINS_LIST[*]}") From 869b81f05e6d526787fe8c41abea3b8d9a2d67d9 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 15:11:39 -0800 Subject: [PATCH 45/58] Fix custom analysis --- script/incremental_build.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 21481c9151ed..a9004e20b4c6 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -29,20 +29,16 @@ fi # # TODO(mklim): Remove everything from this list. https://github.com/flutter/flutter/issues/45440 CUSTOM_ANALYSIS_PLUGINS=( - "in_app_purchase" - "camera" "plugin_platform_interface" "video_player/video_player" "video_player/video_player_platform_interface" "video_player/video_player_web" - "google_maps_flutter/google_maps_flutter_web" "url_launcher/url_launcher_platform_interface" "url_launcher/url_launcher" "device_info/device_info_platform_interface" "device_info/device_info" "connectivity/connectivity_platform_interface" "connectivity/connectivity" - "url_launcher/url_launcher_web" ) # Comma-separated string of the list above readonly CUSTOM_FLAG=$(IFS=, ; echo "${CUSTOM_ANALYSIS_PLUGINS[*]}") From f8437d30349d42d50020d4d3e104b888e6953c21 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 15:54:26 -0800 Subject: [PATCH 46/58] clean up --- packages/connectivity/connectivity/pubspec.yaml | 2 +- .../connectivity/connectivity_platform_interface/pubspec.yaml | 2 +- packages/device_info/device_info/pubspec.yaml | 2 +- .../device_info_platform_interface/analysis_options.yaml | 2 +- .../device_info/device_info_platform_interface/pubspec.yaml | 2 +- packages/plugin_platform_interface/pubspec.yaml | 2 +- .../url_launcher/url_launcher_platform_interface/pubspec.yaml | 2 +- packages/video_player/video_player/pubspec.yaml | 2 +- packages/video_player/video_player_web/pubspec.yaml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index a68ef36ca4cc..4cd80855800c 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -40,5 +40,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index f9b7c87dea43..13ecba9931e0 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -17,5 +17,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index 03610ffb2e90..9a3ba6f4ba16 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -27,5 +27,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/device_info/device_info_platform_interface/analysis_options.yaml b/packages/device_info/device_info_platform_interface/analysis_options.yaml index 32ff54f2748c..3d64bb57fe49 100644 --- a/packages/device_info/device_info_platform_interface/analysis_options.yaml +++ b/packages/device_info/device_info_platform_interface/analysis_options.yaml @@ -1,4 +1,4 @@ include: ../../../analysis_options.yaml analyzer: enable-experiment: - - non-nullable \ No newline at end of file + - non-nullable diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 3e8ce64633e9..02d3749c65c5 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -18,5 +18,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.9.1+hotfix.4 <2.0.0" diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index 66a3b6cc025e..05fc918bf9b5 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -17,7 +17,7 @@ version: 1.1.0-nullsafety.1 repository: https://github.com/flutter/plugins/tree/master/packages/plugin_platform_interface environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" dependencies: meta: ^1.3.0-nullsafety.3 diff --git a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml index 2b5e67d463ff..15721b517d8a 100644 --- a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml +++ b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml @@ -17,5 +17,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.9.1+hotfix.4 <2.0.0" diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index 1c40cf0d6edf..3961391fac44 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -39,5 +39,5 @@ dev_dependencies: pigeon: 0.1.7 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index 098c9f5b95f7..cab66d5ead5b 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -29,5 +29,5 @@ dev_dependencies: pedantic: ^1.10.0-nullsafety.1 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" From 00deb11faf1bb67937630c3ba6e4604d28f4b842 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 15:58:20 -0800 Subject: [PATCH 47/58] Disable version check momentarily --- script/incremental_build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/incremental_build.sh b/script/incremental_build.sh index a9004e20b4c6..95e42c4cfcee 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -71,6 +71,7 @@ else echo running "${ACTIONS[@]}" (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" --exclude="$ALL_EXCLUDED" ${PLUGIN_SHARDING[@]}) echo "Running version check for changed packages" - (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") + # TODO(egarciad): Enable this check once in master. + # (cd "$REPO_DIR" && $PUB global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") fi fi From 6d9f34abed1cec7707b065a1e00c4c38fd523947 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 16:14:35 -0800 Subject: [PATCH 48/58] Version range --- packages/connectivity/connectivity/pubspec.yaml | 2 +- .../connectivity/connectivity_platform_interface/pubspec.yaml | 2 +- .../device_info/device_info_platform_interface/pubspec.yaml | 2 +- .../path_provider/path_provider_platform_interface/pubspec.yaml | 2 +- packages/url_launcher/url_launcher/example/pubspec.yaml | 2 +- packages/url_launcher/url_launcher/pubspec.yaml | 2 +- .../url_launcher/url_launcher_platform_interface/pubspec.yaml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index 4cd80855800c..44794768c7d8 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -36,7 +36,7 @@ dev_dependencies: integration_test: path: ../../integration_test mockito: ^4.1.1 - plugin_platform_interface: 1.1.0-nullsafety.1 + plugin_platform_interface: ^1.1.0-nullsafety.1 pedantic: ^1.10.0-nullsafety.1 environment: diff --git a/packages/connectivity/connectivity_platform_interface/pubspec.yaml b/packages/connectivity/connectivity_platform_interface/pubspec.yaml index 13ecba9931e0..0296cf6b2515 100644 --- a/packages/connectivity/connectivity_platform_interface/pubspec.yaml +++ b/packages/connectivity/connectivity_platform_interface/pubspec.yaml @@ -9,7 +9,7 @@ dependencies: flutter: sdk: flutter meta: ^1.3.0-nullsafety.3 - plugin_platform_interface: 1.1.0-nullsafety.1 + plugin_platform_interface: ^1.1.0-nullsafety.1 dev_dependencies: flutter_test: diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index 02d3749c65c5..1e7fbee1167d 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -9,7 +9,7 @@ dependencies: flutter: sdk: flutter meta: ^1.3.0-nullsafety.3 - plugin_platform_interface: 1.1.0-nullsafety.1 + plugin_platform_interface: ^1.1.0-nullsafety.1 dev_dependencies: flutter_test: diff --git a/packages/path_provider/path_provider_platform_interface/pubspec.yaml b/packages/path_provider/path_provider_platform_interface/pubspec.yaml index 5587c0d7f210..6be9cbd312f5 100644 --- a/packages/path_provider/path_provider_platform_interface/pubspec.yaml +++ b/packages/path_provider/path_provider_platform_interface/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: sdk: flutter meta: ^1.3.0-nullsafety.3 platform: ">=2.0.0 <4.0.0" - plugin_platform_interface: 1.1.0-nullsafety + plugin_platform_interface: ^1.1.0-nullsafety dev_dependencies: flutter_test: diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index 7383badd3d6f..1fdb73cef666 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -14,7 +14,7 @@ dev_dependencies: sdk: flutter pedantic: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - plugin_platform_interface: 1.1.0-nullsafety.1 + plugin_platform_interface: ^1.1.0-nullsafety.1 flutter: uses-material-design: true diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 104550c391f4..f9170cf53a51 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -42,7 +42,7 @@ dev_dependencies: sdk: flutter test: ^1.10.0-nullsafety.1 mockito: ^4.1.1 - plugin_platform_interface: 1.1.0-nullsafety.1 + plugin_platform_interface: ^1.1.0-nullsafety.1 pedantic: ^1.10.0-nullsafety.1 environment: diff --git a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml index 15721b517d8a..75e6363fb7e7 100644 --- a/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml +++ b/packages/url_launcher/url_launcher_platform_interface/pubspec.yaml @@ -8,7 +8,7 @@ version: 2.0.0-nullsafety.1 dependencies: flutter: sdk: flutter - plugin_platform_interface: 1.1.0-nullsafety.1 + plugin_platform_interface: ^1.1.0-nullsafety.1 dev_dependencies: flutter_test: From ffa38443bec06e607440be29808dcff0a1933010 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 16:27:53 -0800 Subject: [PATCH 49/58] Fix pubspecs --- packages/connectivity/connectivity/pubspec.yaml | 4 ---- packages/device_info/device_info/pubspec.yaml | 4 ---- .../path_provider_platform_interface/pubspec.yaml | 2 +- packages/url_launcher/url_launcher/pubspec.yaml | 4 ---- packages/video_player/video_player/pubspec.yaml | 4 ---- packages/video_player/video_player_web/pubspec.yaml | 4 ---- 6 files changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index a22c1376b5cd..b34102a2dc88 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -2,11 +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 -<<<<<<< HEAD version: 3.0.0-nullsafety.1 -======= -version: 2.0.3 ->>>>>>> master flutter: plugin: diff --git a/packages/device_info/device_info/pubspec.yaml b/packages/device_info/device_info/pubspec.yaml index fccfe2f4c755..57c1741270c2 100644 --- a/packages/device_info/device_info/pubspec.yaml +++ b/packages/device_info/device_info/pubspec.yaml @@ -2,14 +2,10 @@ name: device_info description: Flutter plugin providing detailed information about the device (make, model, etc.), and Android or iOS version the app is running on. homepage: https://github.com/flutter/plugins/tree/master/packages/device_info -<<<<<<< HEAD # 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 version: 2.0.0-nullsafety.1 -======= -version: 1.0.1 ->>>>>>> master flutter: plugin: diff --git a/packages/path_provider/path_provider_platform_interface/pubspec.yaml b/packages/path_provider/path_provider_platform_interface/pubspec.yaml index 59c1bf002360..946d2ed4b4fd 100644 --- a/packages/path_provider/path_provider_platform_interface/pubspec.yaml +++ b/packages/path_provider/path_provider_platform_interface/pubspec.yaml @@ -9,7 +9,7 @@ dependencies: flutter: sdk: flutter meta: ^1.3.0-nullsafety.3 - platform: ">=2.0.0 <4.0.0" + platform: ^3.0.0-nullsafety.4 plugin_platform_interface: ^1.1.0-nullsafety dev_dependencies: diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index e37f2672485c..d0abd941a9c2 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -2,11 +2,7 @@ name: url_launcher description: Flutter plugin for launching a URL on Android and iOS. Supports web, phone, SMS, and email schemes. homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher -<<<<<<< HEAD version: 6.0.0-nullsafety.1 -======= -version: 5.7.13 ->>>>>>> master flutter: plugin: diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index 3e86c1d2e39e..f7c84bdd34a8 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -1,14 +1,10 @@ name: video_player description: Flutter plugin for displaying inline video with other Flutter widgets on Android, iOS, and web. -<<<<<<< HEAD # 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 version: 2.0.0-nullsafety.3 -======= -version: 1.0.2 ->>>>>>> master homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player flutter: diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index ffbf1eace063..074a28e7a0d0 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -4,11 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/v # 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -<<<<<<< HEAD version: 2.0.0-nullsafety.1 -======= -version: 0.1.4+2 ->>>>>>> master flutter: plugin: From 59082240b381591d7c3f9512ac22a783109da7ac Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 17:21:17 -0800 Subject: [PATCH 50/58] [video_player_platform_interface] messages.dart use 2.12 --- .../video_player/video_player_platform_interface/CHANGELOG.md | 4 ++++ .../video_player/video_player_platform_interface/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/video_player/video_player_platform_interface/CHANGELOG.md b/packages/video_player/video_player_platform_interface/CHANGELOG.md index 748998fb995d..446fffd9a60e 100644 --- a/packages/video_player/video_player_platform_interface/CHANGELOG.md +++ b/packages/video_player/video_player_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.0-nullsafety.3 + +* `messages.dart` sets Dart `2.12`. + ## 3.0.0-nullsafety.2 * Bump Dart SDK to support null safety. diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml index de35d59cf8ac..ea8d3179cf1d 100644 --- a/packages/video_player/video_player_platform_interface/pubspec.yaml +++ b/packages/video_player/video_player_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the video_player plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_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: 3.0.0-nullsafety.2 +version: 3.0.0-nullsafety.3 dependencies: flutter: From 666c4d505d5b2aef1a3385cfa092dcf20f322810 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 17:23:01 -0800 Subject: [PATCH 51/58] Bump video_player_platform_interface --- packages/video_player/video_player/pubspec.yaml | 2 +- packages/video_player/video_player_web/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index f7c84bdd34a8..cfbc4c65c1de 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -20,7 +20,7 @@ flutter: dependencies: meta: ^1.3.0-nullsafety.3 - video_player_platform_interface: ^3.0.0-nullsafety.2 + video_player_platform_interface: ^3.0.0-nullsafety.3 # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index 074a28e7a0d0..dc1af16c5d94 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: flutter_web_plugins: sdk: flutter meta: ^1.3.0-nullsafety.3 - video_player_platform_interface: ^3.0.0-nullsafety.1 + video_player_platform_interface: ^3.0.0-nullsafety.3 dev_dependencies: flutter_test: From 06209540acde405b7c44e929d23a1edb05254d35 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 17:40:59 -0800 Subject: [PATCH 52/58] pubspec fixes --- packages/connectivity/connectivity/pubspec.yaml | 2 +- packages/local_auth/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index b34102a2dc88..1e6283ca2e1c 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: flutter: sdk: flutter meta: ^1.0.5 - connectivity_platform_interface: 2.0.0-nullsafety.1 + 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 diff --git a/packages/local_auth/pubspec.yaml b/packages/local_auth/pubspec.yaml index 90f82dac6f51..1cccb1932d66 100644 --- a/packages/local_auth/pubspec.yaml +++ b/packages/local_auth/pubspec.yaml @@ -2,7 +2,7 @@ name: local_auth description: Flutter plugin for Android and iOS device authentication sensors such as Fingerprint Reader and Touch ID. homepage: https://github.com/flutter/plugins/tree/master/packages/local_auth -version: 0.6.3+5 +version: 1.0.0-nullsafety flutter: plugin: From d05616e64fba8ab69d30f7d69d3df5dd5ab78c45 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 17:59:02 -0800 Subject: [PATCH 53/58] [flutter_plugin_android_lifecycle] null safety --- packages/flutter_plugin_android_lifecycle/CHANGELOG.md | 4 ++++ packages/flutter_plugin_android_lifecycle/pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md index 43797321f614..d4570eebd1c7 100644 --- a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md +++ b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety + +* Bump Dart SDK. + ## 1.0.12 * Update Flutter SDK constraint. diff --git a/packages/flutter_plugin_android_lifecycle/pubspec.yaml b/packages/flutter_plugin_android_lifecycle/pubspec.yaml index 57441d08de7a..4460ad8ca653 100644 --- a/packages/flutter_plugin_android_lifecycle/pubspec.yaml +++ b/packages/flutter_plugin_android_lifecycle/pubspec.yaml @@ -1,10 +1,10 @@ name: flutter_plugin_android_lifecycle description: Flutter plugin for accessing an Android Lifecycle within other plugins. -version: 1.0.12 +version: 2.0.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/flutter_plugin_android_lifecycle environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13" dependencies: From 748bcb3474be641d361e40316984f8e4254dad10 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 18:00:39 -0800 Subject: [PATCH 54/58] [local_auth] Fix pub dependencies --- packages/local_auth/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/local_auth/pubspec.yaml b/packages/local_auth/pubspec.yaml index 1cccb1932d66..f61f8b3ca4a7 100644 --- a/packages/local_auth/pubspec.yaml +++ b/packages/local_auth/pubspec.yaml @@ -18,8 +18,8 @@ dependencies: sdk: flutter meta: ^1.3.0-nullsafety.3 intl: ^0.17.0-nullsafety.2 - platform: ">=2.0.0 <4.0.0" - flutter_plugin_android_lifecycle: ^1.0.2 + platform: ^3.0.0-nullsafety.4 + flutter_plugin_android_lifecycle: ^2.0.0-nullsafety dev_dependencies: integration_test: From 580656d16eaaab8ac11741bb91e3a4e17972688f Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 18:15:22 -0800 Subject: [PATCH 55/58] [connectivity_macos] null safety --- packages/connectivity/connectivity_macos/CHANGELOG.md | 4 ++++ packages/connectivity/connectivity_macos/pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/connectivity/connectivity_macos/CHANGELOG.md b/packages/connectivity/connectivity_macos/CHANGELOG.md index f7c893e6fdb4..9261b0e789fe 100644 --- a/packages/connectivity/connectivity_macos/CHANGELOG.md +++ b/packages/connectivity/connectivity_macos/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0-nullsafety + +* Update Dart SDK constraint. + ## 0.1.0+8 * Update Flutter SDK constraint. diff --git a/packages/connectivity/connectivity_macos/pubspec.yaml b/packages/connectivity/connectivity_macos/pubspec.yaml index acd608fa2505..dd193f715c2a 100644 --- a/packages/connectivity/connectivity_macos/pubspec.yaml +++ b/packages/connectivity/connectivity_macos/pubspec.yaml @@ -3,7 +3,7 @@ description: macOS implementation of the connectivity plugin. # 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump # the version to 2.0.0. # See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0 -version: 0.1.0+8 +version: 0.2.0-nullsafety homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos flutter: @@ -13,7 +13,7 @@ flutter: pluginClass: ConnectivityPlugin environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.10.0" dependencies: From 34667d44cc1f8668e24058f02f823f119214e2ee Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 18:16:44 -0800 Subject: [PATCH 56/58] [connectivity] connectivity_macos null safety --- packages/connectivity/connectivity/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connectivity/connectivity/pubspec.yaml b/packages/connectivity/connectivity/pubspec.yaml index 1e6283ca2e1c..2f6d78134796 100644 --- a/packages/connectivity/connectivity/pubspec.yaml +++ b/packages/connectivity/connectivity/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: 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_macos: ^0.2.0-nullsafety # connectivity_for_web: ^0.3.0 dev_dependencies: From 2ae46c8ddae83c02811b71c686d849da04805f66 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 11 Dec 2020 19:41:20 -0800 Subject: [PATCH 57/58] Update nnbd plugins --- script/nnbd_plugins.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/script/nnbd_plugins.sh b/script/nnbd_plugins.sh index dc82e2596e79..8b73ecc24e99 100644 --- a/script/nnbd_plugins.sh +++ b/script/nnbd_plugins.sh @@ -7,6 +7,7 @@ readonly NNBD_PLUGINS_LIST=( "connectivity" "device_info" + "flutter_plugin_android_lifecycle" "flutter_webview" "google_sign_in" "local_auth" From 22cde385afef5dda2715422b5ea00549cc72cd13 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Mon, 14 Dec 2020 12:56:10 -0800 Subject: [PATCH 58/58] [flutter_plugin_android_lifecycle] Example SDK app --- packages/flutter_plugin_android_lifecycle/CHANGELOG.md | 4 ++++ .../flutter_plugin_android_lifecycle/example/pubspec.yaml | 2 +- packages/flutter_plugin_android_lifecycle/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md index d4570eebd1c7..6403638b02d4 100644 --- a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md +++ b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.1 + +* Fix example app SDK. + ## 2.0.0-nullsafety * Bump Dart SDK. diff --git a/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml b/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml index a040dbe95d92..2532ab047dcc 100644 --- a/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml +++ b/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the flutter_plugin_android_lifecycle plugin publish_to: 'none' environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" dependencies: flutter: diff --git a/packages/flutter_plugin_android_lifecycle/pubspec.yaml b/packages/flutter_plugin_android_lifecycle/pubspec.yaml index 4460ad8ca653..66b3eba5cb94 100644 --- a/packages/flutter_plugin_android_lifecycle/pubspec.yaml +++ b/packages/flutter_plugin_android_lifecycle/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_plugin_android_lifecycle description: Flutter plugin for accessing an Android Lifecycle within other plugins. -version: 2.0.0-nullsafety +version: 2.0.0-nullsafety.1 homepage: https://github.com/flutter/plugins/tree/master/packages/flutter_plugin_android_lifecycle environment: