Skip to content

Can't pass null in the properties field of CleverTapPlugin.recordEvent("Event Name", properties) on Null Safety #82

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

Closed
snghnishant opened this issue Nov 26, 2021 · 3 comments

Comments

@snghnishant
Copy link

Framework • revision 18116933e7
Engine • revision d3ea636dc5
Tools • Dart 2.14.4

in pubspec.yaml

  sdk: ">=2.12.0 <3.0.0" // Null Safety

# clevertap
  clevertap_plugin: ^1.3.0

There is an issue with CleverTapPlugin.recordEvent("Event Name", properties) method which doesn't allow us to pass null in the properties field when there's no extra data to be passed for an event. This worked until I moved the project to sound null safety. Please update the SDK to support null data in this method.

@william-ct
Copy link
Contributor

Hi @snghnishant, Can you elaborate as to why you need to pass null as the properties for recordEvent(). Instead of null you can send empty property value. For eg:-

var eventData = {'': ''};
CleverTapPlugin.recordEvent("Flutter Event", eventData);

@snghnishant
Copy link
Author

snghnishant commented Nov 29, 2021

passing null makes more sense as it signifies that no extra property is to be sent for that event to work, also it reduces the effort of declaring an extra variable. Though we can also pass a { } as a parameter like CleverTapPlugin.recordEvent("Some eventName", {}) but to me null make more sense when there's no data to be passed. Well, just take this as a suggestion for enhancement but it's up to the maintainer. I am using CleverTapPlugin.recordEvent("Some eventName", {}) for now. Thanks!

@william-ct
Copy link
Contributor

Since we moved our SDK to support sound null safety, we made sure that our method is as shown below:-

static Future<void> recordEvent(String eventName, Map<String, dynamic> properties) async {
     return await _channel.invokeMethod( 'recordEvent', {'eventName': eventName, 'eventData': properties});
}

We do not accept null value for the properties value. More info on sound null safety can be found here

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

No branches or pull requests

2 participants