Quick Actions in Flutter

As a developer, you can define shortcuts to perform specific actions in your app. These shortcuts can be displayed in a supported launcher and help your users quickly start common or recommended tasks within your app.

Android and IOS both have their specific ways implement these shortcuts. In Android, the term used is App Shortcut whereas IOS calls it as Home Screen Quick Actions.

To achieve this functionality in Flutter you can use a plugin called quick_actions. This Flutter plugin allows you to manage and interact with the application’s home screen quick actions.

Quick actions refer to the eponymous concept on iOS and to the App Shortcuts APIs on Android (introduced in Android 7.1 / API level 25). It is safe to run this plugin with earlier versions of Android as it will have any impact on the app.

How to use:

  1. Open Android Studio and create a new Flutter project.

2. Open pubspec.yaml file and add quick_actions plugin dependency under dependencies and hit the Flutter command package get.

3. Inside your lib folder open main.dart and add
import ‘package:quick_actions/quick_actions.dart’;

4. Initialize the library early in your application’s life-cycle by providing a callback, which will then be called whenever the user launches the app via a quick action.

5. Finally, manage the app’s quick actions

Please note, that the type argument should be unique within your application (among all the registered shortcut items). The optional icon should be the name of the native resource (xcassets on iOS or drawable on Android) that the app will display for the quick action.

this is our output