1

i am trying to develop an flutter app that when i click on the app icon a task will start without launching the app , i find the package quick action but when i click on the quick action always app is launched this is my code

 import 'package:flutter/material.dart';
 import 'package:quick_actions/quick_actions.dart';

 void main() {
     WidgetsFlutterBinding.ensureInitialized();
     final QuickActions quickActions = QuickActions();

     quickActions.initialize((shortcutType) {
       if (shortcutType == 'action_one') {
          print('The user tapped on the "Main view" action.');
       }
     });

     quickActions.setShortcutItems(<ShortcutItem>[
       const ShortcutItem(
         type: 'action_one',
         localizedTitle: 'Action one',
         icon: 'AppIcon',
         ),
       const ShortcutItem(
         type: 'action_two', localizedTitle: 'Action two', icon: 'ic_launcher'),
       ]);
   //runApp(MyApp());<-- comment
   }

thank you for helping me

Djamila Jada
  • 141
  • 2
  • 4
  • 11

1 Answers1

0

I think you are doing only one click,
you have to tap long on the app ,
Also check const is missing there.

final QuickActions quickActions = const QuickActions();
Vishwesh Soni
  • 71
  • 1
  • 11
  • yes the options are appeared but i want to start a task without launching the app , i don't want to show the app, about the const it gives me error when i add it – Djamila Jada Dec 25 '19 at 11:21