startSurvey static method

Future<bool?> startSurvey(
  1. String surveyId, [
  2. bool allowMultipleResponses = true,
  3. Map<String, dynamic>? properties,
  4. bool ignoreSurveyStatus = true,
  5. Map<String, dynamic>? hooks,
])

Send to Screeb backend a tracking screen name with optional properties

This api call is important to trigger a survey where the targeting is configured using screens parameters.

Implementation

static Future<bool?> startSurvey(
  String surveyId, [
  bool allowMultipleResponses = true,
  Map<String, dynamic>? properties,
  bool ignoreSurveyStatus = true,
  Map<String, dynamic>? hooks,
]) {
  Map<String, String>? mapHooksId;
  if (hooks != null) {
    mapHooksId = <String, String>{};
    hooks.forEach((key, value) {
      if (key == "version") {
        mapHooksId![key] = value.toString();
      } else {
        // Random UUID
        String uuid = UniqueKey().toString();
        hooksRegistry[uuid] = value;
        mapHooksId![key] = uuid;
      }
    });
  }

  return _channel.invokeMethod(
      'startSurvey', [surveyId, allowMultipleResponses, _formatDates(properties), ignoreSurveyStatus, mapHooksId]);
}