Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: In Flutter Adroid getting error when calling .clearTrigger() #767

Closed
2 of 3 tasks
Vedsaga opened this issue Oct 16, 2023 · 1 comment · Fixed by #771
Closed
2 of 3 tasks

[Bug]: In Flutter Adroid getting error when calling .clearTrigger() #767

Vedsaga opened this issue Oct 16, 2023 · 1 comment · Fixed by #771

Comments

@Vedsaga
Copy link

Vedsaga commented Oct 16, 2023

What happened?

Getting error, when attempting to call clearTrigger() after hot-restart.

D/OneSignal(25690): [main] InAppMessagesManager.addTriggers(triggers: {warrior=true, enthusiast=true, pioneer=true})
D/OneSignal(25690): [main] InAppMessagesManager.addTrigger(key: warrior, value: true)
D/OneSignal(25690): [main] InAppMessagesManager.addTrigger(key: enthusiast, value: true)
D/OneSignal(25690): [main] InAppMessagesManager.addTrigger(key: pioneer, value: true)
E/flutter (25690): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method OneSignal#clearTriggers on channel OneSignal#inappmessages)
E/flutter (25690): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:308:7)
E/flutter (25690): <asynchronous suspension>
E/flutter (25690): #1      OneSignalInAppMessages.clearTriggers (package:onesignal_flutter/src/inappmessages.dart:63:12)
E/flutter (25690): <asynchronous suspension>
E/flutter (25690): 

Steps to reproduce?

1. Normal flutter project setup with `One Signal Flutter` as dependecy
2. Initilize it in `mian.dart`
3. try running clear method before adding any trigger, it will show that error

`main.dart`

Future<void> main() async {
...
  // Initialize the app
  WidgetsFlutterBinding.ensureInitialized();

  //Remove this method to stop OneSignal Debugging
  await OneSignal.Debug.setLogLevel(OSLogLevel.verbose);

  OneSignal.initialize(EnvConstant.ONE_SIGNAL_APP_ID);

    OneSignal.InAppMessages.clearTriggers();
        setAppBannerTriggersForMyTrailPalBadges(earnedBadges);

...
}

What did you expect to happen?

I thought, it will try to clear all trigger in-case if it exist if not then skip and move forward instead of throwing this error.

OneSignal Flutter SDK version

5.0.2

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@emawby
Copy link
Contributor

emawby commented Oct 23, 2023

@Vedsaga thank you for reporting I will have a fix for this shortly!

@emawby emawby mentioned this issue Oct 23, 2023
18 tasks
@emawby emawby linked a pull request Oct 23, 2023 that will close this issue
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants