From 4a58b237bb5308223db3e7734211a29787a85416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Meneses=20Leo=CC=81n?= Date: Tue, 25 Aug 2026 11:12:13 -0600 Subject: [PATCH 1/2] [quick_actions] Adopt code-excerpts for README Replaces the hand-written Dart snippets in the README with pragmas backed by example/lib/readme_excerpts.dart, so they're validated against compilable, analyzed source instead of being free-hand text (one used an untyped callback parameter and print(), which isn't allowed by the repo's lint rules). Also drops the package's ci_config.yaml, whose only purpose was opting it out of that validation. Part of https://github.com/flutter/flutter/issues/102679. FPOCTSMP-10 --- .../quick_actions/quick_actions/CHANGELOG.md | 2 ++ .../quick_actions/quick_actions/README.md | 18 +++++++--- .../quick_actions/ci_config.yaml | 2 -- .../example/lib/readme_excerpts.dart | 35 +++++++++++++++++++ 4 files changed, 50 insertions(+), 7 deletions(-) delete mode 100644 packages/quick_actions/quick_actions/ci_config.yaml create mode 100644 packages/quick_actions/quick_actions/example/lib/readme_excerpts.dart diff --git a/packages/quick_actions/quick_actions/CHANGELOG.md b/packages/quick_actions/quick_actions/CHANGELOG.md index b292466fa63c..e5f47759ca28 100644 --- a/packages/quick_actions/quick_actions/CHANGELOG.md +++ b/packages/quick_actions/quick_actions/CHANGELOG.md @@ -5,6 +5,8 @@ versions of the endorsed platform implementations. * Applications built with older versions of Flutter will continue to use compatible versions of the platform implementations. +* Adopts `code-excerpt` for the README's Dart snippets so they are validated + against compilable, analyzed source. ## 1.1.0 diff --git a/packages/quick_actions/quick_actions/README.md b/packages/quick_actions/quick_actions/README.md index 72dcd42220ee..90706fb29755 100644 --- a/packages/quick_actions/quick_actions/README.md +++ b/packages/quick_actions/quick_actions/README.md @@ -1,4 +1,5 @@ # quick_actions + This Flutter plugin allows you to manage and interact with the application's home screen quick actions. @@ -19,11 +20,12 @@ Initialize the library early in your application's lifecycle by providing a callback, which will then be called whenever the user launches the app via a quick action. + ```dart -final QuickActions quickActions = const QuickActions(); -quickActions.initialize((shortcutType) { +const quickActions = QuickActions(); +quickActions.initialize((String shortcutType) { if (shortcutType == 'action_main') { - print('The user tapped on the "Main view" action.'); + debugPrint('The user tapped on the "Main view" action.'); } // More handling code... }); @@ -31,10 +33,16 @@ quickActions.initialize((shortcutType) { Finally, manage the app's quick actions, for instance: + ```dart -quickActions.setShortcutItems([ +await quickActions.setShortcutItems([ const ShortcutItem(type: 'action_main', localizedTitle: 'Main view', icon: 'icon_main'), - const ShortcutItem(type: 'action_help', localizedTitle: 'Help', localizedSubtitle: 'Tap to get help', icon: 'icon_help') + const ShortcutItem( + type: 'action_help', + localizedTitle: 'Help', + localizedSubtitle: 'Tap to get help', + icon: 'icon_help', + ), ]); ``` diff --git a/packages/quick_actions/quick_actions/ci_config.yaml b/packages/quick_actions/quick_actions/ci_config.yaml deleted file mode 100644 index b352e13e0dfa..000000000000 --- a/packages/quick_actions/quick_actions/ci_config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -# TODO(stuartmorgan): Remove this; see https://github.com/flutter/flutter/issues/102679 -exempt_from_excerpts: true diff --git a/packages/quick_actions/quick_actions/example/lib/readme_excerpts.dart b/packages/quick_actions/quick_actions/example/lib/readme_excerpts.dart new file mode 100644 index 000000000000..595773bd00d9 --- /dev/null +++ b/packages/quick_actions/quick_actions/example/lib/readme_excerpts.dart @@ -0,0 +1,35 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/foundation.dart'; +import 'package:quick_actions/quick_actions.dart'; + +/// Initializes the plugin and handles quick action launches. +void initializeSnippet() { + // #docregion Initialize + const quickActions = QuickActions(); + quickActions.initialize((String shortcutType) { + if (shortcutType == 'action_main') { + debugPrint('The user tapped on the "Main view" action.'); + } + // More handling code... + }); + // #enddocregion Initialize +} + +/// Sets the shortcut items shown on the device's home screen. +Future setShortcutItemsSnippet() async { + const quickActions = QuickActions(); + // #docregion SetShortcutItems + await quickActions.setShortcutItems([ + const ShortcutItem(type: 'action_main', localizedTitle: 'Main view', icon: 'icon_main'), + const ShortcutItem( + type: 'action_help', + localizedTitle: 'Help', + localizedSubtitle: 'Tap to get help', + icon: 'icon_help', + ), + ]); + // #enddocregion SetShortcutItems +} From 729590c5de0d735d8dd9ff9b673c8ef777ebac81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Meneses=20Leo=CC=81n?= Date: Tue, 25 Aug 2026 12:56:33 -0600 Subject: [PATCH 2/2] [quick_actions] Bump to 1.1.1 for the code-excerpts README change Since these README changes will be published, they can't stay under `## NEXT` (same issue as #32/#34's review). Converts NEXT to a real version, with the new excerpt bullet first and the pre-existing NEXT items below it. FPOCTSMP-10 --- packages/quick_actions/quick_actions/CHANGELOG.md | 6 +++--- packages/quick_actions/quick_actions/pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/quick_actions/quick_actions/CHANGELOG.md b/packages/quick_actions/quick_actions/CHANGELOG.md index e5f47759ca28..e19526a3ed4c 100644 --- a/packages/quick_actions/quick_actions/CHANGELOG.md +++ b/packages/quick_actions/quick_actions/CHANGELOG.md @@ -1,12 +1,12 @@ -## NEXT +## 1.1.1 +* Adopts `code-excerpt` for the README's Dart snippets so they are validated + against compilable, analyzed source. * Updates minimum supported SDK version to Flutter 3.38/Dart 3.10. * Updates README to reflect currently supported OS versions for the latest versions of the endorsed platform implementations. * Applications built with older versions of Flutter will continue to use compatible versions of the platform implementations. -* Adopts `code-excerpt` for the README's Dart snippets so they are validated - against compilable, analyzed source. ## 1.1.0 diff --git a/packages/quick_actions/quick_actions/pubspec.yaml b/packages/quick_actions/quick_actions/pubspec.yaml index 445cf4b24e2c..c8e60c904af5 100644 --- a/packages/quick_actions/quick_actions/pubspec.yaml +++ b/packages/quick_actions/quick_actions/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for creating shortcuts on home screen, also known as Quick Actions on iOS and App Shortcuts on Android. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+quick_actions%22 -version: 1.1.0 +version: 1.1.1 environment: sdk: ^3.10.0