trackWithProperties method
Future<void>
trackWithProperties({
- required String eventName,
- String? userId,
- String? partnerAnonymousId,
- required Map<
String, dynamic> properties, - dynamic onCompletion()?,
- dynamic onResultCompletion()?,
override
Implementation
@override
Future<void> trackWithProperties({
required String eventName,
String? userId,
String? partnerAnonymousId,
required Map<String, dynamic> properties,
Function(SprigSurveyState)? onCompletion,
Function(SprigSurveyResult)? onResultCompletion,
}) async {
try {
final Map result = await methodChannel
.invokeMethod('trackWithProperties', {
'eventName': eventName,
'userId': userId,
'partnerAnonymousId': partnerAnonymousId,
'properties': properties,
});
SprigSurveyState surveyState = _surveyStateFromInt(result["surveyState"]);
int surveyId = result["surveyId"] as int;
if (onCompletion != null) {
onCompletion(surveyState);
}
if (onResultCompletion != null) {
onResultCompletion(SprigSurveyResult(surveyState: surveyState, surveyId: surveyId));
}
} catch (e) {
debugPrint("Failed to track event with properties: $e");
}
}