PostHog / PostHog/posthog-flutter

Surveys: Support shuffle questions and shuffle options

Open
#310 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Survey
Dominant language
Dart
Stars
97
Forks
85
Avg merge
1d 8h
Merged PRs (30d)
31

Description

🚨 IMPORTANT

This issue is likely user-facing in the main PostHog app, see surveyVersionRequirements.ts. If you delete or close this issue, be sure to update the version requirements list here.

Summary

The posthog-flutter SDK does not support two shuffle features for surveys in its built-in rendering:

1. Shuffle Questions (shuffleQuestions)

SurveyBottomSheet._buildQuestion() iterates through survey.questions[_currentIndex] in order. The shuffleQuestions field is not present anywhere in the Flutter SDK codebase. The underlying native SDKs parse the field but don't expose it in their display models.

2. Shuffle Options (shuffleOptions)

The shuffleOptions boolean IS available on PostHogDisplayChoiceQuestion, but the built-in SurveyBottomSheet passes choiceQuestion.choices directly to ChoiceQuestionWidget without checking shuffleOptions or shuffling the choices. ChoiceQuestionWidget renders widget.choices in original order.

Expected Behavior

  • When survey.appearance.shuffleQuestions is true, questions should be presented in a randomized order (unless enable_partial_responses is true)
  • When question.shuffleOptions is true on a choice question, choices should be randomized (keeping the open-ended choice at end if present)

Reference Implementation

See posthog-js browser: packages/browser/src/extensions/surveys/surveys-extension-utils.tsx

  • getDisplayOrderQuestions() for question shuffling
  • getDisplayOrderChoices() for option shuffling

Tracking

This is tracked in the survey SDK feature parity issue: https://github.com/PostHog/posthog/issues/45658

This issue was generated by Claude using the /survey-sdk-audit skill.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SurveyBottomSheet._buildQuestion() and ChoiceQuestionWidget, then compare their behavior with getDisplayOrderQuestions() and getDisplayOrderChoices() in packages/browser/src/extensions/surveys/surveys-extension-utils.tsx. Check surveyVersionRequirements.ts before making changes. Done means questions and choices are randomized under the stated conditions, with an open-ended choice remaining last.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.