Skip to main content
The surveys module lets you collect user feedback through in-app surveys. Surveys can trigger automatically based on events or be presented manually.

Present a Survey Manually

final presented = await AppDNA.surveys.present("nps_q1_2026");

if (!presented) {
  print("Survey not found or already completed");
}

Module Access

final surveys = AppDNA.surveys;

Module Methods

MethodSignatureDescription
presentFuture<bool> present(String surveyId)Present a survey manually
promptReviewFuture<void> promptReview()Start the smart review prompting flow
set delegateset delegate(SurveyDelegate?)Set a delegate for survey callbacks

8 Question Types

TypeDisplayResponse
nps0-10 numeric scaleInteger 0-10
csat1-5 satisfaction scaleInteger 1-5
ratingStar ratingInteger 1-5
emoji_scaleEmoji optionsSelected emoji value
yes_noBinary choiceBoolean
single_choiceRadio button optionsSelected option string
multi_choiceCheckbox optionsList of selected strings
free_textText input fieldFree-form string

Smart Review Prompting

A two-step flow that routes happy users to the native store review dialog and unhappy users to a feedback form:
  1. In-app question: “Do you enjoy using [app]?”
  2. Positive — shows App Store / Play Store review dialog
  3. Negative — shows a free-text feedback form
await AppDNA.surveys.promptReview();
Rate-limited: maximum 3 times per year, at least 90 days apart. The SDK enforces these limits automatically.

SurveyDelegate

class FeedbackHandler extends SurveyDelegate {
  @override
  void onSurveyPresented(String surveyId) {
    print("Survey shown: $surveyId");
  }

  @override
  void onSurveyResponseSubmitted(String surveyId, List<SurveyAnswer> responses) {
    for (final answer in responses) {
      if (answer.questionType == "nps") {
        final score = answer.numericValue ?? 0;
        if (score >= 9) showReferralPrompt();
        else if (score <= 6) showSupportLink();
      }
    }
  }

  @override
  void onSurveyDismissed(String surveyId) {
    print("Survey dismissed: $surveyId");
  }
}

AppDNA.surveys.delegate = FeedbackHandler();

SurveyAnswer

PropertyTypeDescription
questionIdStringIdentifier for the question
questionTypeStringQuestion type
stringValueString?Text response
numericValueint?Numeric response
arrayValueList<String>?Multi-select response
boolValuebool?Boolean response

Auto-Tracked Events

EventTrigger
survey_presentedA survey is displayed
survey_response_submittedUser submits a survey response
survey_dismissedSurvey is closed without completing

Full Example

import 'package:appdna_sdk/appdna_sdk.dart';

class FeedbackManager extends SurveyDelegate {
  FeedbackManager() {
    AppDNA.surveys.delegate = this;
  }

  Future<void> askForFeedback() async {
    await AppDNA.surveys.present("nps_q1_2026");
  }

  Future<void> promptForReview() async {
    await AppDNA.surveys.promptReview();
  }

  @override
  void onSurveyPresented(String surveyId) { }

  @override
  void onSurveyResponseSubmitted(String surveyId, List<SurveyAnswer> responses) {
    final nps = responses.firstWhere(
      (a) => a.questionType == "nps",
      orElse: () => SurveyAnswer.empty(),
    );
    final score = nps.numericValue ?? 0;

    if (score >= 9) showReferralPrompt();
    else if (score <= 6) showSupportLink();
  }

  @override
  void onSurveyDismissed(String surveyId) { }
}
Surveys are created in the Console under Feedback > Surveys. Trigger-based surveys appear automatically — use present() for precise control over timing.