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/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..46bc53e63ce6 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 dev_dependencies: - test: ^1.3.0 - mockito: ^3.0.0 + test: ^1.16.0-nullsafety + mockito: ^5.0.0-nullsafety.0 flutter_test: sdk: flutter integration_test: path: ../integration_test - pedantic: ^1.8.0 + pedantic: ^1.10.0-nullsafety 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(() { diff --git a/script/nnbd_plugins.sh b/script/nnbd_plugins.sh index 0e1d3c4bfac5..447e8742cc8b 100644 --- a/script/nnbd_plugins.sh +++ b/script/nnbd_plugins.sh @@ -20,6 +20,7 @@ readonly NNBD_PLUGINS_LIST=( "path_provider" "package_info" "plugin_platform_interface" + "quick_actions" "sensors" "share" "shared_preferences"