trackAndIdentify method
Future<void>
trackAndIdentify({
- required String eventName,
- required String userId,
- required String partnerAnonymousId,
- dynamic onCompletion()?,
- dynamic onResultCompletion()?,
override
Implementation
@override
Future<void> trackAndIdentify({
required String eventName,
required String userId,
required String partnerAnonymousId,
Function(SprigSurveyState)? onCompletion,
Function(SprigSurveyResult)? onResultCompletion,
}) async {
try {
final Map result = await methodChannel.invokeMethod('trackAndIdentify', {
'eventName': eventName,
'userId': userId,
'partnerAnonymousId': partnerAnonymousId,
});
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 and identify event: $e");
}
}