From e8c8cf679e1039596b4b9d1bc4f6b8308dd0a47f Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 22 Feb 2021 10:44:33 -0800 Subject: [PATCH 01/12] [connectivity_macos] move NNBD to stable (#3588) --- .../connectivity/connectivity_macos/CHANGELOG.md | 11 ++--------- .../connectivity_macos/example/lib/main.dart | 14 +++++++------- .../connectivity_macos/example/pubspec.yaml | 6 +++--- .../integration_test/connectivity_test.dart | 7 ++++--- .../connectivity/connectivity_macos/pubspec.yaml | 6 +++--- 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/packages/connectivity/connectivity_macos/CHANGELOG.md b/packages/connectivity/connectivity_macos/CHANGELOG.md index 8547db3441c3..b3ad35a03281 100644 --- a/packages/connectivity/connectivity_macos/CHANGELOG.md +++ b/packages/connectivity/connectivity_macos/CHANGELOG.md @@ -1,14 +1,7 @@ -## 2.0.0-nullsafety - -* Update version to (semi-belatedly) meet 1.0-consistency promise. - -## 0.2.0-nullsafety.1 +## 2.0.0 * Remove placeholder Dart file. - -## 0.2.0-nullsafety - -* Update Dart SDK constraint. +* Update Dart SDK constraint for compatibility with null safety. ## 0.1.0+8 diff --git a/packages/connectivity/connectivity_macos/example/lib/main.dart b/packages/connectivity/connectivity_macos/example/lib/main.dart index 4ad30972679a..07746ed0f722 100644 --- a/packages/connectivity/connectivity_macos/example/lib/main.dart +++ b/packages/connectivity/connectivity_macos/example/lib/main.dart @@ -7,7 +7,7 @@ import 'dart:async'; import 'dart:io'; -import 'package:connectivity/connectivity.dart'; +import 'package:connectivity_platform_interface/connectivity_platform_interface.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -40,9 +40,9 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + MyHomePage({Key? key, this.title}) : super(key: key); - final String title; + final String? title; @override _MyHomePageState createState() => _MyHomePageState(); @@ -50,8 +50,8 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { String _connectionStatus = 'Unknown'; - final Connectivity _connectivity = Connectivity(); - StreamSubscription _connectivitySubscription; + final ConnectivityPlatform _connectivity = ConnectivityPlatform.instance; + 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; + late ConnectivityResult result; // Platform messages may fail, so we use a try/catch PlatformException. try { result = await _connectivity.checkConnectivity(); @@ -100,7 +100,7 @@ class _MyHomePageState extends State { Future _updateConnectionStatus(ConnectivityResult result) async { switch (result) { case ConnectivityResult.wifi: - String wifiName, wifiBSSID, wifiIP; + String? wifiName, wifiBSSID, wifiIP; try { if (Platform.isIOS) { diff --git a/packages/connectivity/connectivity_macos/example/pubspec.yaml b/packages/connectivity/connectivity_macos/example/pubspec.yaml index 49d24e76b717..61cf16854d8b 100644 --- a/packages/connectivity/connectivity_macos/example/pubspec.yaml +++ b/packages/connectivity/connectivity_macos/example/pubspec.yaml @@ -4,7 +4,7 @@ description: Demonstrates how to use the connectivity plugin. dependencies: flutter: sdk: flutter - connectivity: any + connectivity_platform_interface: ^2.0.0 connectivity_macos: # When depending on this package from a real application you should use: # connectivity_macos: ^x.y.z @@ -18,11 +18,11 @@ dev_dependencies: sdk: flutter integration_test: path: ../../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.10.0" diff --git a/packages/connectivity/connectivity_macos/example/test_driver/integration_test/connectivity_test.dart b/packages/connectivity/connectivity_macos/example/test_driver/integration_test/connectivity_test.dart index 54a67337285a..3abe491d193b 100644 --- a/packages/connectivity/connectivity_macos/example/test_driver/integration_test/connectivity_test.dart +++ b/packages/connectivity/connectivity_macos/example/test_driver/integration_test/connectivity_test.dart @@ -2,19 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.9 import 'dart:io'; import 'package:integration_test/integration_test.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:connectivity/connectivity.dart'; +import 'package:connectivity_platform_interface/connectivity_platform_interface.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('Connectivity test driver', () { - Connectivity _connectivity; + ConnectivityPlatform _connectivity; setUpAll(() async { - _connectivity = Connectivity(); + _connectivity = ConnectivityPlatform.instance; }); testWidgets('test connectivity result', (WidgetTester tester) async { diff --git a/packages/connectivity/connectivity_macos/pubspec.yaml b/packages/connectivity/connectivity_macos/pubspec.yaml index 0a22a8ba5f53..781bee88b55a 100644 --- a/packages/connectivity/connectivity_macos/pubspec.yaml +++ b/packages/connectivity/connectivity_macos/pubspec.yaml @@ -1,6 +1,6 @@ name: connectivity_macos description: macOS implementation of the connectivity plugin. -version: 2.0.0-nullsafety +version: 2.0.0 homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos flutter: @@ -10,7 +10,7 @@ flutter: pluginClass: ConnectivityPlugin environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.10.0" dependencies: @@ -18,4 +18,4 @@ dependencies: sdk: flutter dev_dependencies: - pedantic: ^1.8.0 + pedantic: ^1.10.0 From d3ab0718dcc8ba0e2cfdd3dfa5a1e7ce2e9179da Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Mon, 22 Feb 2021 19:48:31 +0100 Subject: [PATCH 02/12] [cross_file] Stable null safety release (#3593) --- packages/cross_file/CHANGELOG.md | 2 +- packages/cross_file/pubspec.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cross_file/CHANGELOG.md b/packages/cross_file/CHANGELOG.md index c9b3d1ab2522..5bbb43f9e882 100644 --- a/packages/cross_file/CHANGELOG.md +++ b/packages/cross_file/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.3.0-nullsafety +## 0.3.0 * Migrated package to null-safety. * **breaking change** According to our unit tests, the API should be backwards-compatible. Some relevant changes were made, however: diff --git a/packages/cross_file/pubspec.yaml b/packages/cross_file/pubspec.yaml index af1b7e7d4c0f..8e09b21d4536 100644 --- a/packages/cross_file/pubspec.yaml +++ b/packages/cross_file/pubspec.yaml @@ -1,18 +1,18 @@ name: cross_file description: An abstraction to allow working with files across multiple platforms. homepage: https://github.com/flutter/plugins/tree/master/packages/cross_file -version: 0.3.0-nullsafety +version: 0.3.0 dependencies: flutter: sdk: flutter - meta: ^1.3.0-nullsafety.3 + meta: ^1.3.0 dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.10.0-nullsafety.3 + pedantic: ^1.10.0 environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.22.0" From 1baec7a192368b1cd271d39993c31531ffa717d1 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 10:53:04 -0800 Subject: [PATCH 03/12] [shared_preferences] Bump platform versions to NNBD stable (#3595) --- .../shared_preferences_linux/CHANGELOG.md | 6 +----- .../example/pubspec.yaml | 6 +++--- .../shared_preferences_linux/pubspec.yaml | 18 ++++++++--------- .../shared_preferences_macos/CHANGELOG.md | 8 ++------ .../example/pubspec.yaml | 6 +++--- .../shared_preferences_macos/pubspec.yaml | 10 +++++----- .../shared_preferences_web/CHANGELOG.md | 6 +----- .../shared_preferences_web/pubspec.yaml | 12 +++++------ .../shared_preferences_windows/CHANGELOG.md | 7 +------ .../example/CHANGELOG.md | 3 --- .../example/pubspec.yaml | 8 ++++---- .../shared_preferences_windows/pubspec.yaml | 20 +++++++++---------- 12 files changed, 45 insertions(+), 65 deletions(-) delete mode 100644 packages/shared_preferences/shared_preferences_windows/example/CHANGELOG.md diff --git a/packages/shared_preferences/shared_preferences_linux/CHANGELOG.md b/packages/shared_preferences/shared_preferences_linux/CHANGELOG.md index 1d287cf57401..a50b4e470c53 100644 --- a/packages/shared_preferences/shared_preferences_linux/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences_linux/CHANGELOG.md @@ -1,8 +1,4 @@ -## 2.0.0-nullsafety - -* Update version for consistency. - -## 0.0.4-nullsafety +## 2.0.0 * Migrate to null-safety. diff --git a/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml b/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml index 12b78c37ea9c..dffdbd7526d2 100644 --- a/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_linux/example/pubspec.yaml @@ -17,11 +17,11 @@ dev_dependencies: sdk: flutter integration_test: path: ../../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" diff --git a/packages/shared_preferences/shared_preferences_linux/pubspec.yaml b/packages/shared_preferences/shared_preferences_linux/pubspec.yaml index ee2288a79b4a..0730ca8d5fec 100644 --- a/packages/shared_preferences/shared_preferences_linux/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_linux/pubspec.yaml @@ -1,6 +1,6 @@ name: shared_preferences_linux description: Linux implementation of the shared_preferences plugin -version: 2.0.0-nullsafety +version: 2.0.0 homepage: https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_linux flutter: @@ -11,19 +11,19 @@ flutter: pluginClass: none environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" dependencies: flutter: sdk: flutter - file: ^6.0.0-nullsafety.4 - meta: ^1.0.4 - path: ^1.8.0-nullsafety.3 - path_provider_linux: ^0.2.0-nullsafety - shared_preferences_platform_interface: ^2.0.0-nullsafety + file: ^6.0.0 + meta: ^1.3.0 + path: ^1.8.0 + path_provider_linux: ^2.0.0 + shared_preferences_platform_interface: ^2.0.0 dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0 diff --git a/packages/shared_preferences/shared_preferences_macos/CHANGELOG.md b/packages/shared_preferences/shared_preferences_macos/CHANGELOG.md index 002e1b7224ea..00c2f628796f 100644 --- a/packages/shared_preferences/shared_preferences_macos/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences_macos/CHANGELOG.md @@ -1,10 +1,6 @@ -## 2.0.0-nullsafety +## 2.0.0 -* Update version to (semi-belatedly) meet 1.0-consistency promise. - -## 0.0.2-nullsafety - -* Update Dart SDK constraint for null safety. +* Migrate to null safety. ## 0.0.1+12 diff --git a/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml b/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml index 6a8e7e4b470a..7db361fccfd5 100644 --- a/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_macos/example/pubspec.yaml @@ -4,7 +4,7 @@ description: Demonstrates how to use the shared_preferences plugin. dependencies: flutter: sdk: flutter - shared_preferences_platform_interface: ^2.0.0-nullsafety + shared_preferences_platform_interface: ^2.0.0 shared_preferences_macos: # When depending on this package from a real application you should use: # shared_preferences_macos: ^x.y.z @@ -18,11 +18,11 @@ dev_dependencies: sdk: flutter integration_test: path: ../../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.8" diff --git a/packages/shared_preferences/shared_preferences_macos/pubspec.yaml b/packages/shared_preferences/shared_preferences_macos/pubspec.yaml index 4f014ecb8929..24811830c1fd 100644 --- a/packages/shared_preferences/shared_preferences_macos/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_macos/pubspec.yaml @@ -1,6 +1,6 @@ name: shared_preferences_macos description: macOS implementation of the shared_preferences plugin. -version: 2.0.0-nullsafety +version: 2.0.0 homepage: https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_macos flutter: @@ -10,13 +10,13 @@ flutter: pluginClass: SharedPreferencesPlugin environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" dependencies: - shared_preferences_platform_interface: ^2.0.0-nullsafety + shared_preferences_platform_interface: ^2.0.0 flutter: sdk: flutter dev_dependencies: - pedantic: ^1.8.0 + pedantic: ^1.10.0 diff --git a/packages/shared_preferences/shared_preferences_web/CHANGELOG.md b/packages/shared_preferences/shared_preferences_web/CHANGELOG.md index 2526ffe4447d..ec08267fe59f 100644 --- a/packages/shared_preferences/shared_preferences_web/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences_web/CHANGELOG.md @@ -1,8 +1,4 @@ -## 2.0.0-nullsafety - -* Update version to (semi-belatedly) meet 1.0-consistency promise. - -## 0.2.0-nullsafety +## 2.0.0 * Migrate to null-safety. diff --git a/packages/shared_preferences/shared_preferences_web/pubspec.yaml b/packages/shared_preferences/shared_preferences_web/pubspec.yaml index 33970f4d857d..9a14b218572a 100644 --- a/packages/shared_preferences/shared_preferences_web/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_web/pubspec.yaml @@ -1,7 +1,7 @@ name: shared_preferences_web description: Web platform implementation of shared_preferences homepage: https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_web -version: 2.0.0-nullsafety +version: 2.0.0 flutter: plugin: @@ -11,18 +11,18 @@ flutter: fileName: shared_preferences_web.dart dependencies: - shared_preferences_platform_interface: ^2.0.0-nullsafety + shared_preferences_platform_interface: ^2.0.0 flutter: sdk: flutter flutter_web_plugins: sdk: flutter - meta: ^1.1.7 + meta: ^1.3.0 dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0 environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.13+hotfix.4" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" diff --git a/packages/shared_preferences/shared_preferences_windows/CHANGELOG.md b/packages/shared_preferences/shared_preferences_windows/CHANGELOG.md index d6a5fb336fe5..6fa4eb162083 100644 --- a/packages/shared_preferences/shared_preferences_windows/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences_windows/CHANGELOG.md @@ -1,9 +1,4 @@ - -## 2.0.0-nullsafety - -* Update version for consistency. - -## 0.0.3-nullsafety +## 2.0.0 * Migrate to null-safety. diff --git a/packages/shared_preferences/shared_preferences_windows/example/CHANGELOG.md b/packages/shared_preferences/shared_preferences_windows/example/CHANGELOG.md deleted file mode 100644 index 41cc7d8192ec..000000000000 --- a/packages/shared_preferences/shared_preferences_windows/example/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -## 0.0.1 - -* TODO: Describe initial release. diff --git a/packages/shared_preferences/shared_preferences_windows/example/pubspec.yaml b/packages/shared_preferences/shared_preferences_windows/example/pubspec.yaml index 575e3f8409c6..6725259c4bdc 100644 --- a/packages/shared_preferences/shared_preferences_windows/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_windows/example/pubspec.yaml @@ -2,13 +2,13 @@ name: shared_preferences_windows_example description: Demonstrates how to use the shared_preferences_windows plugin. environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" dependencies: flutter: sdk: flutter - shared_preferences_windows: ^0.0.1 + shared_preferences_windows: ^2.0.0 dependency_overrides: shared_preferences_windows: @@ -24,7 +24,7 @@ dev_dependencies: sdk: flutter integration_test: path: ../../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true diff --git a/packages/shared_preferences/shared_preferences_windows/pubspec.yaml b/packages/shared_preferences/shared_preferences_windows/pubspec.yaml index 0b95c0c0d14a..d804dd1ddb8f 100644 --- a/packages/shared_preferences/shared_preferences_windows/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_windows/pubspec.yaml @@ -1,7 +1,7 @@ name: shared_preferences_windows description: Windows implementation of shared_preferences homepage: https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_windows -version: 2.0.0-nullsafety +version: 2.0.0 flutter: @@ -12,20 +12,20 @@ flutter: pluginClass: none environment: - sdk: '>=2.12.0-0 <3.0.0' - flutter: ">=1.12.8" + sdk: '>=2.12.0-259.9.beta <3.0.0' + flutter: ">=1.20.0" dependencies: - shared_preferences_platform_interface: ^2.0.0-nullsafety + shared_preferences_platform_interface: ^2.0.0 flutter: sdk: flutter - file: ^6.0.0-nullsafety.4 - meta: ^1.1.7 - path: ^1.6.4 - path_provider_platform_interface: ^2.0.0-nullsafety - path_provider_windows: ^0.1.0-nullsafety.2 + file: ^6.0.0 + meta: ^1.3.0 + path: ^1.8.0 + path_provider_platform_interface: ^2.0.0 + path_provider_windows: ^2.0.0 dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.10.0-nullsafety.3 + pedantic: ^1.10.0 From 6c57e87edb3c37fa807e51d952a443aaba1d42fc Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 10:54:07 -0800 Subject: [PATCH 04/12] [url_launcher] Update platforms to NNBD stable (#3584) Updates all versions to stable. Converts all desktop examples to null-safety, and migrates Linux and macOS to use platform interface for examples rather than app-facing package to eliminate circular dependencies (implementation copied directly from Windows). --- .../url_launcher_linux/CHANGELOG.md | 15 +-- .../integration_test/url_launcher_test.dart | 15 +-- .../url_launcher_linux/example/lib/main.dart | 123 ++---------------- .../url_launcher_linux/example/pubspec.yaml | 8 +- .../example/test_driver/integration_test.dart | 2 + .../url_launcher_linux/pubspec.yaml | 7 +- .../url_launcher_macos/CHANGELOG.md | 16 +-- .../integration_test/url_launcher_test.dart | 15 ++- .../url_launcher_macos/example/lib/main.dart | 123 ++---------------- .../url_launcher_macos/example/pubspec.yaml | 8 +- .../example/test_driver/integration_test.dart | 2 + .../url_launcher_macos/pubspec.yaml | 7 +- .../url_launcher_web/CHANGELOG.md | 2 +- .../url_launcher_web/example/pubspec.yaml | 2 +- .../url_launcher_web/pubspec.yaml | 8 +- .../url_launcher_windows/CHANGELOG.md | 16 +-- .../integration_test/url_launcher_test.dart | 2 + .../example/lib/main.dart | 4 +- .../url_launcher_windows/example/pubspec.yaml | 8 +- .../example/test_driver/integration_test.dart | 2 + .../url_launcher_windows/pubspec.yaml | 7 +- 21 files changed, 86 insertions(+), 306 deletions(-) diff --git a/packages/url_launcher/url_launcher_linux/CHANGELOG.md b/packages/url_launcher/url_launcher_linux/CHANGELOG.md index bd3c15cb31fb..ec9fad53437c 100644 --- a/packages/url_launcher/url_launcher_linux/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_linux/CHANGELOG.md @@ -1,18 +1,9 @@ -## 2.0.0-nullsafety - -* Update version for consistency with other implementations. - -## 0.1.0-nullsafety.3 +## 2.0.0 +* Migrate to null safety. * Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. - -## 0.1.0-nullsafety.2 - * Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)) - -## 0.1.0-nullsafety.1 - -* Migrate to null safety. +* Set `implementation` in pubspec.yaml ## 0.0.2+1 diff --git a/packages/url_launcher/url_launcher_linux/example/integration_test/url_launcher_test.dart b/packages/url_launcher/url_launcher_linux/example/integration_test/url_launcher_test.dart index d11ddb49966b..e1008fddd4e1 100644 --- a/packages/url_launcher/url_launcher_linux/example/integration_test/url_launcher_test.dart +++ b/packages/url_launcher/url_launcher_linux/example/integration_test/url_launcher_test.dart @@ -2,22 +2,21 @@ // 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. +// @dart = 2.9 + import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('canLaunch', (WidgetTester _) async { - expect(await canLaunch('randomstring'), false); - - // Generally all devices should have some default browser. - expect(await canLaunch('http://flutter.dev'), true); + UrlLauncherPlatform launcher = UrlLauncherPlatform.instance; - // Desktop will not necessarily support sms:. + expect(await launcher.canLaunch('randomstring'), false); - // tel: and mailto: links may not be openable on every device. iOS - // simulators notably can't open these link types. + // Generally all devices should have some default browser. + expect(await launcher.canLaunch('http://flutter.dev'), true); }); } diff --git a/packages/url_launcher/url_launcher_linux/example/lib/main.dart b/packages/url_launcher/url_launcher_linux/example/lib/main.dart index a45862012328..f49e9fa290c5 100644 --- a/packages/url_launcher/url_launcher_linux/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_linux/example/lib/main.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; void main() { runApp(MyApp()); @@ -26,7 +26,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 @@ -34,77 +34,24 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - Future _launched; - String _phone = ''; + Future? _launched; Future _launchInBrowser(String url) async { - if (await canLaunch(url)) { - await launch( + if (await UrlLauncherPlatform.instance.canLaunch(url)) { + await UrlLauncherPlatform.instance.launch( url, - forceSafariVC: false, - forceWebView: false, - headers: {'my_header_key': 'my_header_value'}, + useSafariVC: false, + useWebView: false, + enableJavaScript: false, + enableDomStorage: false, + universalLinksOnly: false, + headers: {}, ); } else { throw 'Could not launch $url'; } } - Future _launchInWebViewOrVC(String url) async { - if (await canLaunch(url)) { - await launch( - url, - forceSafariVC: true, - forceWebView: true, - headers: {'my_header_key': 'my_header_value'}, - ); - } else { - throw 'Could not launch $url'; - } - } - - Future _launchInWebViewWithJavaScript(String url) async { - if (await canLaunch(url)) { - await launch( - url, - forceSafariVC: true, - forceWebView: true, - enableJavaScript: true, - ); - } else { - throw 'Could not launch $url'; - } - } - - Future _launchInWebViewWithDomStorage(String url) async { - if (await canLaunch(url)) { - await launch( - url, - forceSafariVC: true, - forceWebView: true, - enableDomStorage: true, - ); - } else { - throw 'Could not launch $url'; - } - } - - Future _launchUniversalLinkIos(String url) async { - if (await canLaunch(url)) { - final bool nativeAppLaunchSucceeded = await launch( - url, - forceSafariVC: false, - universalLinksOnly: true, - ); - if (!nativeAppLaunchSucceeded) { - await launch( - url, - forceSafariVC: true, - ); - } - } - } - Widget _launchStatus(BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); @@ -113,14 +60,6 @@ class _MyHomePageState extends State { } } - Future _makePhoneCall(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } - } - @override Widget build(BuildContext context) { const String toLaunch = 'https://www.cylog.org/headers/'; @@ -133,19 +72,6 @@ class _MyHomePageState extends State { Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.all(16.0), - child: TextField( - onChanged: (String text) => _phone = text, - decoration: const InputDecoration( - hintText: 'Input the phone number to launch')), - ), - ElevatedButton( - onPressed: () => setState(() { - _launched = _makePhoneCall('tel:$_phone'); - }), - child: const Text('Make phone call'), - ), const Padding( padding: EdgeInsets.all(16.0), child: Text(toLaunch), @@ -157,33 +83,6 @@ class _MyHomePageState extends State { child: const Text('Launch in browser'), ), const Padding(padding: EdgeInsets.all(16.0)), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchInWebViewOrVC(toLaunch); - }), - child: const Text('Launch in app'), - ), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchInWebViewWithJavaScript(toLaunch); - }), - child: const Text('Launch in app(JavaScript ON)'), - ), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchInWebViewWithDomStorage(toLaunch); - }), - child: const Text('Launch in app(DOM storage ON)'), - ), - const Padding(padding: EdgeInsets.all(16.0)), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchUniversalLinkIos(toLaunch); - }), - child: const Text( - 'Launch a universal link in a native app, fallback to Safari.(Youtube)'), - ), - const Padding(padding: EdgeInsets.all(16.0)), FutureBuilder(future: _launched, builder: _launchStatus), ], ), diff --git a/packages/url_launcher/url_launcher_linux/example/pubspec.yaml b/packages/url_launcher/url_launcher_linux/example/pubspec.yaml index e95bcd0af478..63c920fba614 100644 --- a/packages/url_launcher/url_launcher_linux/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_linux/example/pubspec.yaml @@ -4,7 +4,6 @@ description: Demonstrates how to use the url_launcher plugin. dependencies: flutter: sdk: flutter - url_launcher: any url_launcher_linux: # When depending on this package from a real application you should use: # url_launcher_linux: ^x.y.z @@ -12,17 +11,18 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ + url_launcher_platform_interface: ^2.0.0 dev_dependencies: integration_test: path: ../../../integration_test flutter_driver: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.1.0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" diff --git a/packages/url_launcher/url_launcher_linux/example/test_driver/integration_test.dart b/packages/url_launcher/url_launcher_linux/example/test_driver/integration_test.dart index 7a2c21338786..a8a56aa90f6a 100644 --- a/packages/url_launcher/url_launcher_linux/example/test_driver/integration_test.dart +++ b/packages/url_launcher/url_launcher_linux/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. +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/url_launcher/url_launcher_linux/pubspec.yaml b/packages/url_launcher/url_launcher_linux/pubspec.yaml index 37a074a57436..cc974094b2d0 100644 --- a/packages/url_launcher/url_launcher_linux/pubspec.yaml +++ b/packages/url_launcher/url_launcher_linux/pubspec.yaml @@ -1,17 +1,18 @@ name: url_launcher_linux description: Linux implementation of the url_launcher plugin. -version: 2.0.0-nullsafety +version: 2.0.0 homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_linux flutter: plugin: + implements: url_launcher platforms: linux: pluginClass: UrlLauncherPlugin environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" dependencies: flutter: diff --git a/packages/url_launcher/url_launcher_macos/CHANGELOG.md b/packages/url_launcher/url_launcher_macos/CHANGELOG.md index 5835c15f64e0..6b0820fd5588 100644 --- a/packages/url_launcher/url_launcher_macos/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_macos/CHANGELOG.md @@ -1,18 +1,8 @@ -## 2.0.0-nullsafety - -* Update version to (semi-belatedly) meet 1.0-consistency promise. - -# 0.1.0-nullsafety.2 - -* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. - -# 0.1.0-nullsafety.1 - -* Bump SDK to support null safety. - -# 0.1.0-nullsafety +## 2.0.0 * Migrate to null safety. +* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. +* Set `implementation` in pubspec.yaml ## 0.0.2+1 diff --git a/packages/url_launcher/url_launcher_macos/example/integration_test/url_launcher_test.dart b/packages/url_launcher/url_launcher_macos/example/integration_test/url_launcher_test.dart index 3e8d34c0b258..d0c1a8bd7325 100644 --- a/packages/url_launcher/url_launcher_macos/example/integration_test/url_launcher_test.dart +++ b/packages/url_launcher/url_launcher_macos/example/integration_test/url_launcher_test.dart @@ -2,23 +2,24 @@ // 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. +// @dart = 2.9 + import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('canLaunch', (WidgetTester _) async { - expect(await canLaunch('randomstring'), false); + UrlLauncherPlatform launcher = UrlLauncherPlatform.instance; + + expect(await launcher.canLaunch('randomstring'), false); // Generally all devices should have some default browser. - expect(await canLaunch('http://flutter.dev'), true); + expect(await launcher.canLaunch('http://flutter.dev'), true); // Generally all devices should have some default SMS app. - expect(await canLaunch('sms:5555555555'), true); - - // tel: and mailto: links may not be openable on every device. iOS - // simulators notably can't open these link types. + expect(await launcher.canLaunch('sms:5555555555'), true); }); } diff --git a/packages/url_launcher/url_launcher_macos/example/lib/main.dart b/packages/url_launcher/url_launcher_macos/example/lib/main.dart index a45862012328..f49e9fa290c5 100644 --- a/packages/url_launcher/url_launcher_macos/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_macos/example/lib/main.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; void main() { runApp(MyApp()); @@ -26,7 +26,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 @@ -34,77 +34,24 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - Future _launched; - String _phone = ''; + Future? _launched; Future _launchInBrowser(String url) async { - if (await canLaunch(url)) { - await launch( + if (await UrlLauncherPlatform.instance.canLaunch(url)) { + await UrlLauncherPlatform.instance.launch( url, - forceSafariVC: false, - forceWebView: false, - headers: {'my_header_key': 'my_header_value'}, + useSafariVC: false, + useWebView: false, + enableJavaScript: false, + enableDomStorage: false, + universalLinksOnly: false, + headers: {}, ); } else { throw 'Could not launch $url'; } } - Future _launchInWebViewOrVC(String url) async { - if (await canLaunch(url)) { - await launch( - url, - forceSafariVC: true, - forceWebView: true, - headers: {'my_header_key': 'my_header_value'}, - ); - } else { - throw 'Could not launch $url'; - } - } - - Future _launchInWebViewWithJavaScript(String url) async { - if (await canLaunch(url)) { - await launch( - url, - forceSafariVC: true, - forceWebView: true, - enableJavaScript: true, - ); - } else { - throw 'Could not launch $url'; - } - } - - Future _launchInWebViewWithDomStorage(String url) async { - if (await canLaunch(url)) { - await launch( - url, - forceSafariVC: true, - forceWebView: true, - enableDomStorage: true, - ); - } else { - throw 'Could not launch $url'; - } - } - - Future _launchUniversalLinkIos(String url) async { - if (await canLaunch(url)) { - final bool nativeAppLaunchSucceeded = await launch( - url, - forceSafariVC: false, - universalLinksOnly: true, - ); - if (!nativeAppLaunchSucceeded) { - await launch( - url, - forceSafariVC: true, - ); - } - } - } - Widget _launchStatus(BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); @@ -113,14 +60,6 @@ class _MyHomePageState extends State { } } - Future _makePhoneCall(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } - } - @override Widget build(BuildContext context) { const String toLaunch = 'https://www.cylog.org/headers/'; @@ -133,19 +72,6 @@ class _MyHomePageState extends State { Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.all(16.0), - child: TextField( - onChanged: (String text) => _phone = text, - decoration: const InputDecoration( - hintText: 'Input the phone number to launch')), - ), - ElevatedButton( - onPressed: () => setState(() { - _launched = _makePhoneCall('tel:$_phone'); - }), - child: const Text('Make phone call'), - ), const Padding( padding: EdgeInsets.all(16.0), child: Text(toLaunch), @@ -157,33 +83,6 @@ class _MyHomePageState extends State { child: const Text('Launch in browser'), ), const Padding(padding: EdgeInsets.all(16.0)), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchInWebViewOrVC(toLaunch); - }), - child: const Text('Launch in app'), - ), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchInWebViewWithJavaScript(toLaunch); - }), - child: const Text('Launch in app(JavaScript ON)'), - ), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchInWebViewWithDomStorage(toLaunch); - }), - child: const Text('Launch in app(DOM storage ON)'), - ), - const Padding(padding: EdgeInsets.all(16.0)), - ElevatedButton( - onPressed: () => setState(() { - _launched = _launchUniversalLinkIos(toLaunch); - }), - child: const Text( - 'Launch a universal link in a native app, fallback to Safari.(Youtube)'), - ), - const Padding(padding: EdgeInsets.all(16.0)), FutureBuilder(future: _launched, builder: _launchStatus), ], ), diff --git a/packages/url_launcher/url_launcher_macos/example/pubspec.yaml b/packages/url_launcher/url_launcher_macos/example/pubspec.yaml index 2e66616101c2..40bb4eaba67a 100644 --- a/packages/url_launcher/url_launcher_macos/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/example/pubspec.yaml @@ -4,7 +4,6 @@ description: Demonstrates how to use the url_launcher plugin. dependencies: flutter: sdk: flutter - url_launcher: any url_launcher_macos: # When depending on this package from a real application you should use: # url_launcher_macos: ^x.y.z @@ -12,17 +11,18 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ + url_launcher_platform_interface: ^2.0.0 dev_dependencies: integration_test: path: ../../../integration_test flutter_driver: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.1.0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" diff --git a/packages/url_launcher/url_launcher_macos/example/test_driver/integration_test.dart b/packages/url_launcher/url_launcher_macos/example/test_driver/integration_test.dart index 7a2c21338786..a8a56aa90f6a 100644 --- a/packages/url_launcher/url_launcher_macos/example/test_driver/integration_test.dart +++ b/packages/url_launcher/url_launcher_macos/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. +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/url_launcher/url_launcher_macos/pubspec.yaml b/packages/url_launcher/url_launcher_macos/pubspec.yaml index bd918bfda24e..6b5e6cf2a825 100644 --- a/packages/url_launcher/url_launcher_macos/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/pubspec.yaml @@ -1,18 +1,19 @@ name: url_launcher_macos description: macOS implementation of the url_launcher plugin. -version: 2.0.0-nullsafety +version: 2.0.0 homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_macos flutter: plugin: + implements: url_launcher platforms: macos: pluginClass: UrlLauncherPlugin fileName: url_launcher_macos.dart environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" dependencies: flutter: diff --git a/packages/url_launcher/url_launcher_web/CHANGELOG.md b/packages/url_launcher/url_launcher_web/CHANGELOG.md index 49d72457ecd9..7da0ba0a8095 100644 --- a/packages/url_launcher/url_launcher_web/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_web/CHANGELOG.md @@ -1,4 +1,4 @@ -# 2.0.0-nullsafety +# 2.0.0 - Migrate to null safety. diff --git a/packages/url_launcher/url_launcher_web/example/pubspec.yaml b/packages/url_launcher/url_launcher_web/example/pubspec.yaml index 5fc060fe7abe..51748610e971 100644 --- a/packages/url_launcher/url_launcher_web/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/example/pubspec.yaml @@ -18,5 +18,5 @@ dev_dependencies: sdk: flutter environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.26.0-0" # For integration_test from sdk diff --git a/packages/url_launcher/url_launcher_web/pubspec.yaml b/packages/url_launcher/url_launcher_web/pubspec.yaml index b9f957a7ee76..371a40e16f7b 100644 --- a/packages/url_launcher/url_launcher_web/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/pubspec.yaml @@ -1,7 +1,7 @@ name: url_launcher_web description: Web platform implementation of url_launcher homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_web -version: 2.0.0-nullsafety +version: 2.0.0 flutter: plugin: @@ -11,7 +11,7 @@ flutter: fileName: url_launcher_web.dart dependencies: - url_launcher_platform_interface: ^2.0.0-nullsafety + url_launcher_platform_interface: ^2.0.0 meta: ^1.3.0 # null safe flutter: sdk: flutter @@ -24,5 +24,5 @@ dev_dependencies: sdk: flutter environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" diff --git a/packages/url_launcher/url_launcher_windows/CHANGELOG.md b/packages/url_launcher/url_launcher_windows/CHANGELOG.md index b57785524d08..e906254eef44 100644 --- a/packages/url_launcher/url_launcher_windows/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_windows/CHANGELOG.md @@ -1,18 +1,8 @@ -## 2.0.0-nullsafety - -* Update version to (semi-belatedly) meet 1.0-consistency promise. - -## 0.1.0-nullsafety.2 - -* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. - -## 0.1.0-nullsafety.1 - -* Bump Dart SDK to support null safety. - -## 0.1.0-nullsafety +## 2.0.0 * Migrate to null-safety. +* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. +* Set `implementation` in pubspec.yaml ## 0.0.2+1 diff --git a/packages/url_launcher/url_launcher_windows/example/integration_test/url_launcher_test.dart b/packages/url_launcher/url_launcher_windows/example/integration_test/url_launcher_test.dart index 2617150348ee..e1008fddd4e1 100644 --- a/packages/url_launcher/url_launcher_windows/example/integration_test/url_launcher_test.dart +++ b/packages/url_launcher/url_launcher_windows/example/integration_test/url_launcher_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. +// @dart = 2.9 + import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; diff --git a/packages/url_launcher/url_launcher_windows/example/lib/main.dart b/packages/url_launcher/url_launcher_windows/example/lib/main.dart index e6c9f477b5a4..f49e9fa290c5 100644 --- a/packages/url_launcher/url_launcher_windows/example/lib/main.dart +++ b/packages/url_launcher/url_launcher_windows/example/lib/main.dart @@ -26,7 +26,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 @@ -34,7 +34,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - Future _launched; + Future? _launched; Future _launchInBrowser(String url) async { if (await UrlLauncherPlatform.instance.canLaunch(url)) { diff --git a/packages/url_launcher/url_launcher_windows/example/pubspec.yaml b/packages/url_launcher/url_launcher_windows/example/pubspec.yaml index 2de2bcf14f44..8a273ba65020 100644 --- a/packages/url_launcher/url_launcher_windows/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_windows/example/pubspec.yaml @@ -4,7 +4,7 @@ description: Demonstrates the Windows implementation of the url_launcher plugin. dependencies: flutter: sdk: flutter - url_launcher_platform_interface: any + url_launcher_platform_interface: ^2.0.0 url_launcher_windows: # When depending on this package from a real application you should use: # url_launcher_windows: ^x.y.z @@ -18,11 +18,11 @@ dev_dependencies: path: ../../../integration_test flutter_driver: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.1.0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" diff --git a/packages/url_launcher/url_launcher_windows/example/test_driver/integration_test.dart b/packages/url_launcher/url_launcher_windows/example/test_driver/integration_test.dart index 7a2c21338786..a8a56aa90f6a 100644 --- a/packages/url_launcher/url_launcher_windows/example/test_driver/integration_test.dart +++ b/packages/url_launcher/url_launcher_windows/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. +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/url_launcher/url_launcher_windows/pubspec.yaml b/packages/url_launcher/url_launcher_windows/pubspec.yaml index 368c3f831c2a..e5b611f86af0 100644 --- a/packages/url_launcher/url_launcher_windows/pubspec.yaml +++ b/packages/url_launcher/url_launcher_windows/pubspec.yaml @@ -1,17 +1,18 @@ name: url_launcher_windows description: Windows implementation of the url_launcher plugin. -version: 2.0.0-nullsafety +version: 2.0.0 homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher_windows flutter: plugin: + implements: url_launcher platforms: windows: pluginClass: UrlLauncherPlugin environment: - sdk: ">=2.12.0-0 <3.0.0" - flutter: ">=1.12.8" + sdk: ">=2.12.0-259.9.beta <3.0.0" + flutter: ">=1.20.0" dependencies: flutter: From f14eaecb33f6b7d1e4d359c17e4832fe216a18f1 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 12:01:18 -0800 Subject: [PATCH 05/12] [battery] Bump version for NNBD stable (#3594) Also replaces Mockito with test/Fake since the usage is a simple fake. --- packages/battery/battery/CHANGELOG.md | 2 +- packages/battery/battery/example/pubspec.yaml | 4 ++-- packages/battery/battery/pubspec.yaml | 14 +++++++------- packages/battery/battery/test/battery_test.dart | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/battery/battery/CHANGELOG.md b/packages/battery/battery/CHANGELOG.md index d907ca33fe1e..ae9e798c364d 100644 --- a/packages/battery/battery/CHANGELOG.md +++ b/packages/battery/battery/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.0-nullsafety +## 2.0.0 * Migrate to null safety. diff --git a/packages/battery/battery/example/pubspec.yaml b/packages/battery/battery/example/pubspec.yaml index e118a7c21540..ea3d5d39ae14 100644 --- a/packages/battery/battery/example/pubspec.yaml +++ b/packages/battery/battery/example/pubspec.yaml @@ -17,11 +17,11 @@ dev_dependencies: sdk: flutter integration_test: path: ../../../integration_test - pedantic: ^1.10.0-nullsafety + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5" diff --git a/packages/battery/battery/pubspec.yaml b/packages/battery/battery/pubspec.yaml index 455905d62a9a..a987bd8c45a6 100644 --- a/packages/battery/battery/pubspec.yaml +++ b/packages/battery/battery/pubspec.yaml @@ -2,7 +2,7 @@ name: battery description: Flutter plugin for accessing information about the battery state (full, charging, discharging) on Android and iOS. homepage: https://github.com/flutter/plugins/tree/master/packages/battery/battery -version: 2.0.0-nullsafety +version: 2.0.0 flutter: plugin: @@ -16,18 +16,18 @@ flutter: dependencies: flutter: sdk: flutter - meta: ^1.3.0-nullsafety - battery_platform_interface: ^2.0.0-nullsafety + meta: ^1.3.0 + battery_platform_interface: ^2.0.0 dev_dependencies: - mockito: ^5.0.0-nullsafety.0 flutter_test: sdk: flutter - plugin_platform_interface: ^1.1.0-nullsafety + plugin_platform_interface: ">=1.0.0 <3.0.0" integration_test: path: ../../integration_test - pedantic: ^1.10.0-nullsafety + pedantic: ^1.10.0 + test: ^1.16.3 environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5" diff --git a/packages/battery/battery/test/battery_test.dart b/packages/battery/battery/test/battery_test.dart index 43155c59692c..ff1bf1596250 100644 --- a/packages/battery/battery/test/battery_test.dart +++ b/packages/battery/battery/test/battery_test.dart @@ -4,11 +4,11 @@ import 'dart:async'; +import 'package:battery/battery.dart'; import 'package:battery_platform_interface/battery_platform_interface.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; -import 'package:battery/battery.dart'; -import 'package:mockito/mockito.dart'; +import 'package:test/fake.dart'; void main() { group('battery', () { @@ -30,7 +30,7 @@ void main() { }); } -class MockBatteryPlatform extends Mock +class MockBatteryPlatform extends Fake with MockPlatformInterfaceMixin implements BatteryPlatform { Future batteryLevel() async { From bb3fc5ad22aca210d617d5a5c8f958bc3c629d62 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 12:04:17 -0800 Subject: [PATCH 06/12] [path_provider] Update to stable NNBD (#3582) Bumps the versions in the app-facing package to make it stable NNBD. Changes the interface of four core methods to non-nullable, and adds a new exceptions if they aren't provided by the platform implementations. The list is somewhat arbitrary, but these seem like the four that are core enough that any implementation should either provide them, or explicitly say they don't have such a concept via UnsupportedError, since there isn't an obvious way for a developer to fall back if they are unexpectedly missing. --- .../path_provider/path_provider/CHANGELOG.md | 11 +- .../path_provider/example/pubspec.yaml | 4 +- .../path_provider/lib/path_provider.dart | 52 +++++-- .../path_provider/path_provider/pubspec.yaml | 18 +-- .../test/path_provider_test.dart | 127 +++++++++++++++--- 5 files changed, 165 insertions(+), 47 deletions(-) diff --git a/packages/path_provider/path_provider/CHANGELOG.md b/packages/path_provider/path_provider/CHANGELOG.md index a52711bf0736..c28c617bbea4 100644 --- a/packages/path_provider/path_provider/CHANGELOG.md +++ b/packages/path_provider/path_provider/CHANGELOG.md @@ -1,11 +1,10 @@ -## 2.0.0-nullsafety.1 - -* Require latest path_provider_windows to avoid potential issues - with breaking changes in `ffi` and `win32`. - -## 2.0.0-nullsafety +## 2.0.0 * Migrate to null safety. +* BREAKING CHANGE: Path accessors that return non-nullable results will throw + a `MissingPlatformDirectoryException` if the platform implementation is unable + to get the corresponding directory (except on platforms where the method is + explicitly unsupported, where they will continue to throw `UnsupportedError`). ## 1.6.28 diff --git a/packages/path_provider/path_provider/example/pubspec.yaml b/packages/path_provider/path_provider/example/pubspec.yaml index cef0449ca01a..68c751a81843 100644 --- a/packages/path_provider/path_provider/example/pubspec.yaml +++ b/packages/path_provider/path_provider/example/pubspec.yaml @@ -17,11 +17,11 @@ dev_dependencies: path: ../../../integration_test flutter_driver: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5" diff --git a/packages/path_provider/path_provider/lib/path_provider.dart b/packages/path_provider/path_provider/lib/path_provider.dart index 1560c3399e72..da9c0b3d48a3 100644 --- a/packages/path_provider/path_provider/lib/path_provider.dart +++ b/packages/path_provider/path_provider/lib/path_provider.dart @@ -20,6 +20,27 @@ set disablePathProviderPlatformOverride(bool override) {} bool _manualDartRegistrationNeeded = true; +/// An exception thrown when a directory that should always be available on +/// the current platform cannot be obtained. +class MissingPlatformDirectoryException implements Exception { + /// Creates a new exception + MissingPlatformDirectoryException(this.message, {this.details}); + + /// The explanation of the exception. + final String message; + + /// Added details, if any. + /// + /// E.g., an error object from the platform implementation. + final Object? details; + + @override + String toString() { + String detailsAddition = details == null ? '' : ': $details'; + return 'MissingPlatformDirectoryException($message)$detailsAddition'; + } +} + PathProviderPlatform get _platform { // This is to manually endorse Dart implementations until automatic // registration of Dart plugins is implemented. For details see @@ -51,10 +72,14 @@ PathProviderPlatform get _platform { /// On iOS, this uses the `NSCachesDirectory` API. /// /// On Android, this uses the `getCacheDir` API on the context. -Future getTemporaryDirectory() async { +/// +/// Throws a `MissingPlatformDirectoryException` if the system is unable to +/// provide the directory. +Future getTemporaryDirectory() async { final String? path = await _platform.getTemporaryPath(); if (path == null) { - return null; + throw MissingPlatformDirectoryException( + 'Unable to get temporary directory'); } return Directory(path); } @@ -69,10 +94,14 @@ Future getTemporaryDirectory() async { /// If this directory does not exist, it is created automatically. /// /// On Android, this function uses the `getFilesDir` API on the context. -Future getApplicationSupportDirectory() async { +/// +/// Throws a `MissingPlatformDirectoryException` if the system is unable to +/// provide the directory. +Future getApplicationSupportDirectory() async { final String? path = await _platform.getApplicationSupportPath(); if (path == null) { - return null; + throw MissingPlatformDirectoryException( + 'Unable to get application support directory'); } return Directory(path); @@ -83,10 +112,13 @@ Future getApplicationSupportDirectory() async { /// /// On Android, this function throws an [UnsupportedError] as no equivalent /// path exists. -Future getLibraryDirectory() async { +/// +/// Throws a `MissingPlatformDirectoryException` if the system is unable to +/// provide the directory on a supported platform. +Future getLibraryDirectory() async { final String? path = await _platform.getLibraryPath(); if (path == null) { - return null; + throw MissingPlatformDirectoryException('Unable to get library directory'); } return Directory(path); } @@ -100,10 +132,14 @@ Future getLibraryDirectory() async { /// On Android, this uses the `getDataDirectory` API on the context. Consider /// using [getExternalStorageDirectory] instead if data is intended to be visible /// to the user. -Future getApplicationDocumentsDirectory() async { +/// +/// Throws a `MissingPlatformDirectoryException` if the system is unable to +/// provide the directory. +Future getApplicationDocumentsDirectory() async { final String? path = await _platform.getApplicationDocumentsPath(); if (path == null) { - return null; + throw MissingPlatformDirectoryException( + 'Unable to get application documents directory'); } return Directory(path); } diff --git a/packages/path_provider/path_provider/pubspec.yaml b/packages/path_provider/path_provider/pubspec.yaml index 3d79c99e2223..81941dac67b1 100644 --- a/packages/path_provider/path_provider/pubspec.yaml +++ b/packages/path_provider/path_provider/pubspec.yaml @@ -1,7 +1,7 @@ name: path_provider description: Flutter plugin for getting commonly used locations on host platform file systems, such as the temp and app data directories. homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider -version: 2.0.0-nullsafety.1 +version: 2.0.0 flutter: plugin: @@ -21,10 +21,10 @@ flutter: dependencies: flutter: sdk: flutter - path_provider_platform_interface: ^2.0.0-nullsafety - path_provider_macos: ^0.0.5-nullsafety - path_provider_linux: ^0.2.0-nullsafety - path_provider_windows: ^0.1.0-nullsafety.3 + path_provider_platform_interface: ^2.0.0 + path_provider_macos: ^2.0.0 + path_provider_linux: ^2.0.0 + path_provider_windows: ^2.0.0 dev_dependencies: integration_test: @@ -33,10 +33,10 @@ dev_dependencies: sdk: flutter flutter_driver: sdk: flutter - pedantic: ^1.10.0-nullsafety - mockito: ^5.0.0-nullsafety.0 - plugin_platform_interface: ^1.1.0-nullsafety + pedantic: ^1.10.0 + plugin_platform_interface: ">=1.0.0 <3.0.0" + test: ^1.16.0 environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5" diff --git a/packages/path_provider/path_provider/test/path_provider_test.dart b/packages/path_provider/path_provider/test/path_provider_test.dart index aec5e060f631..759e9c09ffc2 100644 --- a/packages/path_provider/path_provider/test/path_provider_test.dart +++ b/packages/path_provider/path_provider/test/path_provider_test.dart @@ -6,10 +6,10 @@ import 'dart:io' show Directory; import 'dart:async'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; import 'package:path_provider/path_provider.dart'; import 'package:path_provider_platform_interface/path_provider_platform_interface.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; +import 'package:test/fake.dart'; const String kTemporaryPath = 'temporaryPath'; const String kApplicationSupportPath = 'applicationSupportPath'; @@ -20,31 +20,30 @@ const String kExternalCachePath = 'externalCachePath'; const String kExternalStoragePath = 'externalStoragePath'; void main() { - group('PathProvider', () { - TestWidgetsFlutterBinding.ensureInitialized(); - + TestWidgetsFlutterBinding.ensureInitialized(); + group('PathProvider full implementation', () { setUp(() async { - PathProviderPlatform.instance = MockPathProviderPlatform(); + PathProviderPlatform.instance = FakePathProviderPlatform(); }); test('getTemporaryDirectory', () async { - Directory? result = await getTemporaryDirectory(); - expect(result?.path, kTemporaryPath); + Directory result = await getTemporaryDirectory(); + expect(result.path, kTemporaryPath); }); test('getApplicationSupportDirectory', () async { - Directory? result = await getApplicationSupportDirectory(); - expect(result?.path, kApplicationSupportPath); + Directory result = await getApplicationSupportDirectory(); + expect(result.path, kApplicationSupportPath); }); test('getLibraryDirectory', () async { - Directory? result = await getLibraryDirectory(); - expect(result?.path, kLibraryPath); + Directory result = await getLibraryDirectory(); + expect(result.path, kLibraryPath); }); test('getApplicationDocumentsDirectory', () async { - Directory? result = await getApplicationDocumentsDirectory(); - expect(result?.path, kApplicationDocumentsPath); + Directory result = await getApplicationDocumentsDirectory(); + expect(result.path, kApplicationDocumentsPath); }); test('getExternalStorageDirectory', () async { @@ -69,42 +68,126 @@ void main() { expect(result?.path, kDownloadsPath); }); }); + + group('PathProvider null implementation', () { + setUp(() async { + PathProviderPlatform.instance = AllNullFakePathProviderPlatform(); + }); + + test('getTemporaryDirectory throws on null', () async { + expect(getTemporaryDirectory(), + throwsA(isA())); + }); + + test('getApplicationSupportDirectory throws on null', () async { + expect(getApplicationSupportDirectory(), + throwsA(isA())); + }); + + test('getLibraryDirectory throws on null', () async { + expect(getLibraryDirectory(), + throwsA(isA())); + }); + + test('getApplicationDocumentsDirectory throws on null', () async { + expect(getApplicationDocumentsDirectory(), + throwsA(isA())); + }); + + test('getExternalStorageDirectory passes null through', () async { + Directory? result = await getExternalStorageDirectory(); + expect(result, isNull); + }); + + test('getExternalCacheDirectories passes null through', () async { + List? result = await getExternalCacheDirectories(); + expect(result, isNull); + }); + + test('getExternalStorageDirectories passes null through', () async { + List? result = await getExternalStorageDirectories(); + expect(result, isNull); + }); + + test('getDownloadsDirectory passses null through', () async { + Directory? result = await getDownloadsDirectory(); + expect(result, isNull); + }); + }); } -class MockPathProviderPlatform extends Mock +class FakePathProviderPlatform extends Fake with MockPlatformInterfaceMixin implements PathProviderPlatform { - Future getTemporaryPath() async { + Future getTemporaryPath() async { return kTemporaryPath; } - Future getApplicationSupportPath() async { + Future getApplicationSupportPath() async { return kApplicationSupportPath; } - Future getLibraryPath() async { + Future getLibraryPath() async { return kLibraryPath; } - Future getApplicationDocumentsPath() async { + Future getApplicationDocumentsPath() async { return kApplicationDocumentsPath; } - Future getExternalStoragePath() async { + Future getExternalStoragePath() async { return kExternalStoragePath; } - Future> getExternalCachePaths() async { + Future?> getExternalCachePaths() async { return [kExternalCachePath]; } - Future> getExternalStoragePaths({ + Future?> getExternalStoragePaths({ StorageDirectory? type, }) async { return [kExternalStoragePath]; } - Future getDownloadsPath() async { + Future getDownloadsPath() async { return kDownloadsPath; } } + +class AllNullFakePathProviderPlatform extends Fake + with MockPlatformInterfaceMixin + implements PathProviderPlatform { + Future getTemporaryPath() async { + return null; + } + + Future getApplicationSupportPath() async { + return null; + } + + Future getLibraryPath() async { + return null; + } + + Future getApplicationDocumentsPath() async { + return null; + } + + Future getExternalStoragePath() async { + return null; + } + + Future?> getExternalCachePaths() async { + return null; + } + + Future?> getExternalStoragePaths({ + StorageDirectory? type, + }) async { + return null; + } + + Future getDownloadsPath() async { + return null; + } +} From b98d72548a2142c618b1e7e270f89ca9db67c039 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 22 Feb 2021 12:15:13 -0800 Subject: [PATCH 07/12] [connectivity_macos] fix version (#3599) --- packages/connectivity/connectivity_macos/CHANGELOG.md | 2 +- packages/connectivity/connectivity_macos/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/connectivity/connectivity_macos/CHANGELOG.md b/packages/connectivity/connectivity_macos/CHANGELOG.md index b3ad35a03281..7031e48318dd 100644 --- a/packages/connectivity/connectivity_macos/CHANGELOG.md +++ b/packages/connectivity/connectivity_macos/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.0 +## 0.2.0 * Remove placeholder Dart file. * Update Dart SDK constraint for compatibility with null safety. diff --git a/packages/connectivity/connectivity_macos/pubspec.yaml b/packages/connectivity/connectivity_macos/pubspec.yaml index 781bee88b55a..b8f36c8f55b4 100644 --- a/packages/connectivity/connectivity_macos/pubspec.yaml +++ b/packages/connectivity/connectivity_macos/pubspec.yaml @@ -1,6 +1,6 @@ name: connectivity_macos description: macOS implementation of the connectivity plugin. -version: 2.0.0 +version: 0.2.0 homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos flutter: From 0838c8253e8938fd92d1a3fee54ae4f4b5cd5594 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 12:29:49 -0800 Subject: [PATCH 08/12] [google_maps_flutter] Bump platform interface version for NNBD stable (#3598) --- .../CHANGELOG.md | 6 +----- .../pubspec.yaml | 14 +++++++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md index 7b2268395caf..0d5748d13f79 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md @@ -1,8 +1,4 @@ -## 2.0.0-nullsafety.1 - -* Fix overly-restrictive type check. - -## 2.0.0-nullsafety +## 2.0.0 * Migrated to null-safety. * BREAKING CHANGE: Removed deprecated APIs. diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml index 2ec9e449a335..602efe3e6c62 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml @@ -3,22 +3,22 @@ description: A common platform interface for the google_maps_flutter plugin. homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter_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.1 +version: 2.0.0 dependencies: flutter: sdk: flutter - meta: ^1.0.5 - plugin_platform_interface: ^1.1.0-nullsafety.2 - stream_transform: ^2.0.0-nullsafety.0 - collection: ^1.14.13 + meta: ^1.3.0 + plugin_platform_interface: ">=1.0.0 <3.0.0" + stream_transform: ^2.0.0 + collection: ^1.15.0 dev_dependencies: flutter_test: sdk: flutter mockito: ^5.0.0-nullsafety.0 - pedantic: ^1.8.0 + pedantic: ^1.10.0 environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: '>=2.12.0-259.9.beta <3.0.0' flutter: ">=1.9.1+hotfix.4" From 61a736f46528a9069d50800d3055d4c168bcee03 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 22 Feb 2021 12:44:04 -0800 Subject: [PATCH 09/12] [device_info_platform_interface] null safety stable release (#3597) --- .../device_info_platform_interface/CHANGELOG.md | 11 ++--------- .../device_info_platform_interface/pubspec.yaml | 12 ++++++------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/device_info/device_info_platform_interface/CHANGELOG.md b/packages/device_info/device_info_platform_interface/CHANGELOG.md index d4bc81e0f0aa..23e9bc770c95 100644 --- a/packages/device_info/device_info_platform_interface/CHANGELOG.md +++ b/packages/device_info/device_info_platform_interface/CHANGELOG.md @@ -1,16 +1,9 @@ -## 2.0.0-nullsafety.2 +## 2.0.0 +* Migrate to null safety. * 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. - -## 2.0.0-nullsafety - -* Migrate to null safety. - ## 1.0.2 - Update Flutter SDK constraint. diff --git a/packages/device_info/device_info_platform_interface/pubspec.yaml b/packages/device_info/device_info_platform_interface/pubspec.yaml index ca72cc753b63..3887aea3eff2 100644 --- a/packages/device_info/device_info_platform_interface/pubspec.yaml +++ b/packages/device_info/device_info_platform_interface/pubspec.yaml @@ -3,20 +3,20 @@ 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 dependencies: flutter: sdk: flutter - meta: ^1.3.0-nullsafety.3 - plugin_platform_interface: ^1.1.0-nullsafety.1 + meta: ^1.3.0 + plugin_platform_interface: ">=1.0.0 <3.0.0" dev_dependencies: flutter_test: sdk: flutter - test: ^1.10.0-nullsafety.1 - pedantic: ^1.10.0-nullsafety.1 + test: ^1.16.3 + pedantic: ^1.10.0 environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.9.1+hotfix.4" From 0ea8ef89b63097d8d9974307f9665bb02d9ee4d7 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 12:59:52 -0800 Subject: [PATCH 10/12] [share] Bump version for NNBD stable (#3600) --- packages/share/CHANGELOG.md | 15 +++------------ packages/share/example/lib/image_previews.dart | 10 +++++----- packages/share/example/lib/main.dart | 2 +- packages/share/example/pubspec.yaml | 6 +++--- .../test_driver/test/integration_test.dart | 2 ++ packages/share/pubspec.yaml | 14 +++++++------- 6 files changed, 21 insertions(+), 28 deletions(-) diff --git a/packages/share/CHANGELOG.md b/packages/share/CHANGELOG.md index ba44db433d17..20afdea9f054 100644 --- a/packages/share/CHANGELOG.md +++ b/packages/share/CHANGELOG.md @@ -1,18 +1,9 @@ -## 2.0.0-nullsafety.3 - -* Update README with the new documentation urls. - -## 2.0.0-nullsafety.2 +## 2.0.0 +* Migrate to null safety. * Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. - -## 2.0.0-nullsafety.1 - * Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)) - -## 2.0.0-nullsafety - -* Migrate to null safety. +* Update README with the new documentation urls. ## 0.6.5+5 diff --git a/packages/share/example/lib/image_previews.dart b/packages/share/example/lib/image_previews.dart index 61ecec43bdc7..9070749267fc 100644 --- a/packages/share/example/lib/image_previews.dart +++ b/packages/share/example/lib/image_previews.dart @@ -9,11 +9,11 @@ class ImagePreviews extends StatelessWidget { final List imagePaths; /// Callback when an image should be removed - final Function(int) onDelete; + final Function(int)? onDelete; /// Creates a widget for preview of images. [imagePaths] can not be empty /// and all contained paths need to be non empty. - const ImagePreviews(this.imagePaths, {Key key, this.onDelete}) + const ImagePreviews(this.imagePaths, {Key? key, this.onDelete}) : super(key: key); @override @@ -26,7 +26,7 @@ class ImagePreviews extends StatelessWidget { for (int i = 0; i < imagePaths.length; i++) { imageWidgets.add(_ImagePreview( imagePaths[i], - onDelete: onDelete != null ? () => onDelete(i) : null, + onDelete: onDelete != null ? () => onDelete!(i) : null, )); } @@ -39,9 +39,9 @@ class ImagePreviews extends StatelessWidget { class _ImagePreview extends StatelessWidget { final String imagePath; - final VoidCallback onDelete; + final VoidCallback? onDelete; - const _ImagePreview(this.imagePath, {Key key, this.onDelete}) + const _ImagePreview(this.imagePath, {Key? key, this.onDelete}) : super(key: key); @override diff --git a/packages/share/example/lib/main.dart b/packages/share/example/lib/main.dart index a9ebd6bb79fb..8d6a78305db9 100644 --- a/packages/share/example/lib/main.dart +++ b/packages/share/example/lib/main.dart @@ -116,7 +116,7 @@ class DemoAppState extends State { // RenderObject in its descendent tree when it's not // a RenderObjectWidget. The ElevatedButton's RenderObject // has its position and size after it's built. - final RenderBox box = context.findRenderObject(); + final RenderBox box = context.findRenderObject() as RenderBox; if (imagePaths.isNotEmpty) { await Share.shareFiles(imagePaths, diff --git a/packages/share/example/pubspec.yaml b/packages/share/example/pubspec.yaml index 372633ec19ec..2df76efb6ca2 100644 --- a/packages/share/example/pubspec.yaml +++ b/packages/share/example/pubspec.yaml @@ -11,18 +11,18 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - image_picker: ^0.6.7+4 + image_picker: ^0.7.0 dev_dependencies: flutter_driver: sdk: flutter integration_test: path: ../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.0.0-dev.28.0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.9.1+hotfix.2" diff --git a/packages/share/example/test_driver/test/integration_test.dart b/packages/share/example/test_driver/test/integration_test.dart index 7a2c21338786..a8a56aa90f6a 100644 --- a/packages/share/example/test_driver/test/integration_test.dart +++ b/packages/share/example/test_driver/test/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. +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/share/pubspec.yaml b/packages/share/pubspec.yaml index 4d2b231bbdfb..e8a116799433 100644 --- a/packages/share/pubspec.yaml +++ b/packages/share/pubspec.yaml @@ -2,7 +2,7 @@ name: share description: Flutter plugin for sharing content via the platform share UI, using the ACTION_SEND intent on Android and UIActivityViewController on iOS. homepage: https://github.com/flutter/plugins/tree/master/packages/share -version: 2.0.0-nullsafety.3 +version: 2.0.0 flutter: plugin: @@ -14,20 +14,20 @@ flutter: pluginClass: FLTSharePlugin dependencies: - meta: ^1.3.0-nullsafety.6 - mime: ^1.0.0-nullsafety.0 + meta: ^1.3.0 + mime: ^1.0.0 flutter: sdk: flutter dev_dependencies: - test: ^1.16.0-nullsafety.13 - mockito: ^4.1.3 + test: ^1.16.3 + mockito: ^5.0.0-nullsafety.7 flutter_test: sdk: flutter integration_test: path: ../integration_test - pedantic: ^1.10.0-nullsafety.3 + pedantic: ^1.10.0 environment: flutter: ">=1.12.13+hotfix.5" - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" From 39964495426d74f0e4149ff904ca8d702a116329 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 13:40:29 -0800 Subject: [PATCH 11/12] [android_intent] Bump version for NNBD stable (#3601) --- packages/android_intent/CHANGELOG.md | 12 +++--------- .../integration_test/android_intent_test.dart | 6 ++++++ packages/android_intent/example/pubspec.yaml | 4 ++-- .../example/test_driver/integration_test.dart | 6 ++++++ packages/android_intent/pubspec.yaml | 14 +++++++------- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/packages/android_intent/CHANGELOG.md b/packages/android_intent/CHANGELOG.md index 3e878a50aac2..70926b4f4943 100644 --- a/packages/android_intent/CHANGELOG.md +++ b/packages/android_intent/CHANGELOG.md @@ -1,14 +1,8 @@ -## 2.0.0-nullsafety.2 - -* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. - -## 2.0.0-nullsafety.1 - -* Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)) - -## 2.0.0-nullsafety +## 2.0.0 * Migrate to null safety. +* Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)) +* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. ## 0.3.7+8 diff --git a/packages/android_intent/example/integration_test/android_intent_test.dart b/packages/android_intent/example/integration_test/android_intent_test.dart index 78a667b27a09..e11a5e4e4898 100644 --- a/packages/android_intent/example/integration_test/android_intent_test.dart +++ b/packages/android_intent/example/integration_test/android_intent_test.dart @@ -1,3 +1,9 @@ +// 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. + +// @dart = 2.9 + import 'dart:io'; import 'package:android_intent/android_intent.dart'; diff --git a/packages/android_intent/example/pubspec.yaml b/packages/android_intent/example/pubspec.yaml index 7a0814d4acc0..2b1aab823d12 100644 --- a/packages/android_intent/example/pubspec.yaml +++ b/packages/android_intent/example/pubspec.yaml @@ -17,12 +17,12 @@ dev_dependencies: path: ../../integration_test flutter_driver: sdk: flutter - pedantic: ^1.8.0 + pedantic: ^1.10.0 # The following section is specific to Flutter. flutter: uses-material-design: true environment: - sdk: ">=2.3.0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5" diff --git a/packages/android_intent/example/test_driver/integration_test.dart b/packages/android_intent/example/test_driver/integration_test.dart index 34483b996049..0378ec31ee3c 100644 --- a/packages/android_intent/example/test_driver/integration_test.dart +++ b/packages/android_intent/example/test_driver/integration_test.dart @@ -1,3 +1,9 @@ +// 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. + +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:io'; diff --git a/packages/android_intent/pubspec.yaml b/packages/android_intent/pubspec.yaml index c61460718fc1..ba830bddf1df 100644 --- a/packages/android_intent/pubspec.yaml +++ b/packages/android_intent/pubspec.yaml @@ -1,7 +1,7 @@ name: android_intent description: Flutter plugin for launching Android Intents. Not supported on iOS. homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent -version: 2.0.0-nullsafety.2 +version: 2.0.0 flutter: plugin: @@ -13,15 +13,15 @@ flutter: dependencies: flutter: sdk: flutter - platform: ^3.0.0-nullsafety.4 - meta: ^1.3.0-nullsafety.6 + platform: ^3.0.0 + meta: ^1.3.0 dev_dependencies: - test: ^1.16.0-nullsafety.13 - mockito: ^4.1.3 + test: ^1.16.3 + mockito: ^5.0.0-nullsafety.7 flutter_test: sdk: flutter - pedantic: ^1.10.0-nullsafety.1 + pedantic: ^1.10.0 environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5" From 5f29f9e7c3655221bcbb9c2c306d3a1194cd4155 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Feb 2021 14:10:35 -0800 Subject: [PATCH 12/12] [shared_preferences] Bump app-facing version for NNBD stable (#3602) --- .../shared_preferences/CHANGELOG.md | 6 +----- .../shared_preferences/example/pubspec.yaml | 4 ++-- .../shared_preferences/pubspec.yaml | 18 +++++++++--------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/shared_preferences/shared_preferences/CHANGELOG.md b/packages/shared_preferences/shared_preferences/CHANGELOG.md index a14ebf547659..2e05c8bbff05 100644 --- a/packages/shared_preferences/shared_preferences/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences/CHANGELOG.md @@ -1,8 +1,4 @@ -## 2.0.0-nullsafety.1 - -* Fix crash when list string's type is dynamic. - -## 2.0.0-nullsafety +## 2.0.0 * Migrate to null-safety. diff --git a/packages/shared_preferences/shared_preferences/example/pubspec.yaml b/packages/shared_preferences/shared_preferences/example/pubspec.yaml index ab6c8fe11f7f..84692d76e5a1 100644 --- a/packages/shared_preferences/shared_preferences/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences/example/pubspec.yaml @@ -17,11 +17,11 @@ dev_dependencies: sdk: flutter integration_test: path: ../../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0 flutter: uses-material-design: true environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.9.1+hotfix.2" diff --git a/packages/shared_preferences/shared_preferences/pubspec.yaml b/packages/shared_preferences/shared_preferences/pubspec.yaml index fc556972a847..583600d6a78b 100644 --- a/packages/shared_preferences/shared_preferences/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences/pubspec.yaml @@ -2,7 +2,7 @@ name: shared_preferences description: Flutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android. homepage: https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences -version: 2.0.0-nullsafety.1 +version: 2.0.0 flutter: plugin: @@ -20,19 +20,19 @@ flutter: default_package: shared_preferences_web dependencies: - meta: ^1.0.4 + meta: ^1.3.0 flutter: sdk: flutter - shared_preferences_platform_interface: ^2.0.0-nullsafety + shared_preferences_platform_interface: ^2.0.0 # 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(franciscojma): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 - shared_preferences_linux: ^0.0.4-nullsafety - shared_preferences_macos: ^0.0.2-nullsafety - shared_preferences_web: ^0.2.0-nullsafety - shared_preferences_windows: ^0.0.3-nullsafety + shared_preferences_linux: ^2.0.0 + shared_preferences_macos: ^2.0.0 + shared_preferences_web: ^2.0.0 + shared_preferences_windows: ^2.0.0 dev_dependencies: flutter_test: @@ -41,8 +41,8 @@ dev_dependencies: sdk: flutter integration_test: path: ../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0 environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5"