khanmujeeb687 / flutter_pinned_shortcut

MIT License
1 stars 5 forks source link

PlatformException(flutter_pinned_shortcuts_no_activity, There is no activity available when launching action, null, null) #2

Open yasersojoodi opened 1 year ago

yasersojoodi commented 1 year ago

E/flutter ( 8315): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(flutter_pinned_shortcuts_no_activity, There is no activity available when launching action, null, null) E/flutter ( 8315): #0 StandardMethodCodec.decodeEnvelope message_codecs.dart:653 E/flutter ( 8315): #1 MethodChannel._invokeMethod platform_channel.dart:315 E/flutter ( 8315): E/flutter ( 8315): #2 MethodChannelFlutterPinnedShortcut.getLaunchAction flutter_pinned_shortcut_method_channel.dart:30 E/flutter ( 8315): E/flutter ( 8315):

yasersojoodi commented 1 year ago

hi i use GetX package for state management. i put getIncommingAction() in onInit(){} but i recieve this error each time restart.

My Full Code :

`class HomeViewController extends GetxController { BaseViewController baseViewController = Get.find(); AppThemeController appThemeController = Get.find(); var currentUser = constantEmptyUser.obs; var loading = false.obs;

final FlutterPinnedShortcut flutterPinnedShortcutPlugin = FlutterPinnedShortcut();

@override void onInit() { currentUser.value = LocalServices().getCurrentUser(); super.onInit(); getIncomingAction(); }

void getIncomingAction() { flutterPinnedShortcutPlugin.getLaunchAction( (surehId) { if (surehId != null) { final SurehsViewController surehsViewController = Get.put(SurehsViewController()); Sureh sureh = surehsViewController.searchedSurehs .where((item) => item.id == int.parse(surehId)) .first; Get.toNamed( AppRoutes.mSurehRoute, arguments: { "sureh": sureh, }, ); } }, ); } }`