OneSignal-Flutter-SDK
OneSignal-Flutter-SDK copied to clipboard
[Bug]: In Flutter Adroid getting error when calling `.clearTrigger()`
trafficstars
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
- [X] Android
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@Vedsaga thank you for reporting I will have a fix for this shortly!