From d3dd34dbdb7efe23383fc10ee846544591328248 Mon Sep 17 00:00:00 2001 From: Maurice Parrish Date: Tue, 29 Dec 2020 13:25:34 -0500 Subject: [PATCH 1/3] migrate to null safety --- packages/quick_actions/CHANGELOG.md | 4 ++++ .../integration_test/quick_actions_test.dart | 2 ++ packages/quick_actions/example/lib/main.dart | 2 +- packages/quick_actions/example/pubspec.yaml | 4 ++-- .../example/test_driver/integration_test.dart | 2 ++ packages/quick_actions/lib/quick_actions.dart | 15 ++++++++------- packages/quick_actions/pubspec.yaml | 12 ++++++------ .../quick_actions/test/quick_actions_test.dart | 2 +- 8 files changed, 26 insertions(+), 17 deletions(-) diff --git a/packages/quick_actions/CHANGELOG.md b/packages/quick_actions/CHANGELOG.md index a0c1b1f43c66..774ccac1bb44 100644 --- a/packages/quick_actions/CHANGELOG.md +++ b/packages/quick_actions/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0-nullsafety + +* Migrate to null safety. + ## 0.4.0+12 * Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)) diff --git a/packages/quick_actions/example/integration_test/quick_actions_test.dart b/packages/quick_actions/example/integration_test/quick_actions_test.dart index 03ecfe491d93..4bcf8a858a0c 100644 --- a/packages/quick_actions/example/integration_test/quick_actions_test.dart +++ b/packages/quick_actions/example/integration_test/quick_actions_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:quick_actions/quick_actions.dart'; diff --git a/packages/quick_actions/example/lib/main.dart b/packages/quick_actions/example/lib/main.dart index fc289810ea24..a7e9d5e4c031 100644 --- a/packages/quick_actions/example/lib/main.dart +++ b/packages/quick_actions/example/lib/main.dart @@ -25,7 +25,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key}) : super(key: key); + MyHomePage({Key? key}) : super(key: key); @override _MyHomePageState createState() => _MyHomePageState(); diff --git a/packages/quick_actions/example/pubspec.yaml b/packages/quick_actions/example/pubspec.yaml index 6f9c0efd01af..9b79e6e680ed 100644 --- a/packages/quick_actions/example/pubspec.yaml +++ b/packages/quick_actions/example/pubspec.yaml @@ -12,11 +12,11 @@ dev_dependencies: sdk: flutter integration_test: path: ../../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.3 flutter: uses-material-design: true environment: - sdk: ">=2.0.0-dev.28.0 <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.9.1+hotfix.2 <2.0.0" diff --git a/packages/quick_actions/example/test_driver/integration_test.dart b/packages/quick_actions/example/test_driver/integration_test.dart index 7a2c21338786..a8a56aa90f6a 100644 --- a/packages/quick_actions/example/test_driver/integration_test.dart +++ b/packages/quick_actions/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/quick_actions/lib/quick_actions.dart b/packages/quick_actions/lib/quick_actions.dart index 933162a1a47c..875661244a74 100644 --- a/packages/quick_actions/lib/quick_actions.dart +++ b/packages/quick_actions/lib/quick_actions.dart @@ -22,8 +22,8 @@ class ShortcutItem { /// /// Only [icon] should be nullable. It will remain `null` if unset. const ShortcutItem({ - @required this.type, - @required this.localizedTitle, + required this.type, + required this.localizedTitle, this.icon, }); @@ -35,7 +35,7 @@ class ShortcutItem { /// Name of native resource (xcassets etc; NOT a Flutter asset) to be /// displayed as the icon for this item. - final String icon; + final String? icon; } /// Quick actions plugin. @@ -65,7 +65,8 @@ class QuickActions { assert(call.method == 'launch'); handler(call.arguments); }); - final String action = await channel.invokeMethod('getLaunchAction'); + final String? action = + await channel.invokeMethod('getLaunchAction'); if (action != null) { handler(action); } @@ -73,7 +74,7 @@ class QuickActions { /// Sets the [ShortcutItem]s to become the app's quick actions. Future setShortcutItems(List items) async { - final List> itemsList = + final List> itemsList = items.map(_serializeItem).toList(); await channel.invokeMethod('setShortcutItems', itemsList); } @@ -82,8 +83,8 @@ class QuickActions { Future clearShortcutItems() => channel.invokeMethod('clearShortcutItems'); - Map _serializeItem(ShortcutItem item) { - return { + Map _serializeItem(ShortcutItem item) { + return { 'type': item.type, 'localizedTitle': item.localizedTitle, 'icon': item.icon, diff --git a/packages/quick_actions/pubspec.yaml b/packages/quick_actions/pubspec.yaml index e76cd9ce8bd2..a95225edcee8 100644 --- a/packages/quick_actions/pubspec.yaml +++ b/packages/quick_actions/pubspec.yaml @@ -2,7 +2,7 @@ name: quick_actions description: Flutter plugin for creating shortcuts on home screen, also known as Quick Actions on iOS and App Shortcuts on Android. homepage: https://github.com/flutter/plugins/tree/master/packages/quick_actions -version: 0.4.0+12 +version: 0.5.0-nullsafety flutter: plugin: @@ -16,17 +16,17 @@ flutter: dependencies: flutter: sdk: flutter - meta: ^1.0.5 + meta: ^1.3.0-nullsafety.6 dev_dependencies: - test: ^1.3.0 - mockito: ^3.0.0 + test: ^1.16.0-nullsafety.13 + mockito: ^5.0.0-nullsafety.0 flutter_test: sdk: flutter integration_test: path: ../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety.3 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" flutter: ">=1.12.13+hotfix.5" diff --git a/packages/quick_actions/test/quick_actions_test.dart b/packages/quick_actions/test/quick_actions_test.dart index ffb6de1024fd..8066719e5113 100644 --- a/packages/quick_actions/test/quick_actions_test.dart +++ b/packages/quick_actions/test/quick_actions_test.dart @@ -10,7 +10,7 @@ import 'package:quick_actions/quick_actions.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); - QuickActions quickActions; + late QuickActions quickActions; final List log = []; setUp(() { From b8194b3c3d6026bc9d02d66b9e774f69af39c083 Mon Sep 17 00:00:00 2001 From: Maurice Parrish Date: Wed, 13 Jan 2021 17:10:58 -0500 Subject: [PATCH 2/3] use min dependency and add to nnbd plugins --- packages/quick_actions/example/pubspec.yaml | 2 +- packages/quick_actions/pubspec.yaml | 6 +++--- script/nnbd_plugins.sh | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/quick_actions/example/pubspec.yaml b/packages/quick_actions/example/pubspec.yaml index 9b79e6e680ed..baf891f640f6 100644 --- a/packages/quick_actions/example/pubspec.yaml +++ b/packages/quick_actions/example/pubspec.yaml @@ -12,7 +12,7 @@ dev_dependencies: sdk: flutter integration_test: path: ../../integration_test - pedantic: ^1.10.0-nullsafety.3 + pedantic: ^1.10.0-nullsafety flutter: uses-material-design: true diff --git a/packages/quick_actions/pubspec.yaml b/packages/quick_actions/pubspec.yaml index a95225edcee8..46bc53e63ce6 100644 --- a/packages/quick_actions/pubspec.yaml +++ b/packages/quick_actions/pubspec.yaml @@ -16,16 +16,16 @@ flutter: dependencies: flutter: sdk: flutter - meta: ^1.3.0-nullsafety.6 + meta: ^1.3.0-nullsafety dev_dependencies: - test: ^1.16.0-nullsafety.13 + test: ^1.16.0-nullsafety mockito: ^5.0.0-nullsafety.0 flutter_test: sdk: flutter integration_test: path: ../integration_test - pedantic: ^1.10.0-nullsafety.3 + pedantic: ^1.10.0-nullsafety environment: sdk: ">=2.12.0-0 <3.0.0" diff --git a/script/nnbd_plugins.sh b/script/nnbd_plugins.sh index 0cab28abe2ab..08a6ea218bde 100644 --- a/script/nnbd_plugins.sh +++ b/script/nnbd_plugins.sh @@ -14,6 +14,7 @@ readonly NNBD_PLUGINS_LIST=( "local_auth" "path_provider" "plugin_platform_interface" + "quick_actions" "share" "url_launcher" "video_player" From 0355f5863aeac9b2123a1c2b0167695c970ee786 Mon Sep 17 00:00:00 2001 From: Maurice Parrish Date: Mon, 8 Feb 2021 12:45:50 -0800 Subject: [PATCH 3/3] revert example --- .../example/integration_test/quick_actions_test.dart | 2 -- packages/quick_actions/example/lib/main.dart | 2 +- packages/quick_actions/example/pubspec.yaml | 4 ++-- .../quick_actions/example/test_driver/integration_test.dart | 2 -- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/quick_actions/example/integration_test/quick_actions_test.dart b/packages/quick_actions/example/integration_test/quick_actions_test.dart index 4bcf8a858a0c..03ecfe491d93 100644 --- a/packages/quick_actions/example/integration_test/quick_actions_test.dart +++ b/packages/quick_actions/example/integration_test/quick_actions_test.dart @@ -2,8 +2,6 @@ // 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:quick_actions/quick_actions.dart'; diff --git a/packages/quick_actions/example/lib/main.dart b/packages/quick_actions/example/lib/main.dart index a7e9d5e4c031..fc289810ea24 100644 --- a/packages/quick_actions/example/lib/main.dart +++ b/packages/quick_actions/example/lib/main.dart @@ -25,7 +25,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key? key}) : super(key: key); + MyHomePage({Key key}) : super(key: key); @override _MyHomePageState createState() => _MyHomePageState(); diff --git a/packages/quick_actions/example/pubspec.yaml b/packages/quick_actions/example/pubspec.yaml index baf891f640f6..6f9c0efd01af 100644 --- a/packages/quick_actions/example/pubspec.yaml +++ b/packages/quick_actions/example/pubspec.yaml @@ -12,11 +12,11 @@ dev_dependencies: sdk: flutter integration_test: path: ../../integration_test - pedantic: ^1.10.0-nullsafety + pedantic: ^1.8.0 flutter: uses-material-design: true environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.0.0-dev.28.0 <3.0.0" flutter: ">=1.9.1+hotfix.2 <2.0.0" diff --git a/packages/quick_actions/example/test_driver/integration_test.dart b/packages/quick_actions/example/test_driver/integration_test.dart index a8a56aa90f6a..7a2c21338786 100644 --- a/packages/quick_actions/example/test_driver/integration_test.dart +++ b/packages/quick_actions/example/test_driver/integration_test.dart @@ -2,8 +2,6 @@ // 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';