Repository navigation
feat: send $flutter_version only on Application Installed/Updated - #651
Merged
Merged
Conversation
Move $flutter_version off every Dart-captured event. Dart passes the build's Flutter version to the native plugins at setup, and each plugin installs a native beforeSend that adds it to the Application Installed and Application Updated events the native SDKs capture. Web no longer sends it.
Contributor
posthog-flutter Compliance ReportDate: 2026-10-08 17:50:32 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
turnipdabeets
marked this pull request as ready for review
October 8, 2026 18:04
dustinbyrne
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
We're cutting per-event properties whose value never changes within a build, since they cost storage on every event (Slack, RFC #1263).
$flutter_version(added in #640, released in 5.52.0) is one: it's compiled into the build, so it can only change when the app is rebuilt. The iOS equivalent is PostHog/posthog-ios#923, which moves$app_build_xcode/$app_build_sdktoApplication Installed/Application Updated.On iOS, macOS and Android those lifecycle events are captured by the native SDKs and never pass through Dart, so Dart can't add properties to them. Both native SDKs already have a
beforeSendchain on their config, and the plugin builds that config, so this needs no native SDK changes:FLUTTER_VERSIONdefine, Flutter 3.32+) as aflutterVersionsetup argument. It's not added toPostHogConfig.toMap(), so there's no public API change (make checkApiDartpasses).beforeSendthat sets$flutter_versiononApplication InstalledandApplication Updatedonly. The plugin didn't install a native eventbeforeSendbefore this, and customers'beforeSendcallbacks run in Dart, so nothing gets overwritten.capture,screenandcaptureExceptionno longer add$flutter_version. This reverts feat: add $flutter_version to captured events #640's Dart wiring, along with the_capturesplit it needed forbeforeSendremovals to stick.$flutter_versionis no longer sent at all. posthog-js has no install/update events to put it on.Behavior change
Anyone filtering or breaking down on
$flutter_versionon regular events (shipped in 5.52.0, two days ago) has to switch toApplication Installed/Application Updated. It also won't be sent:captureApplicationLifecycleEventsis offAUTO_INIT), because native setup runs before Dart can pass the versionA rebuild on a new Flutter version that keeps the same build number won't emit
Application Updated. That's the same limitation posthog-ios#923 has.💚 How did you test it?
flutter test(787 passed).flutter test --platform chromeon the CI file list: everything passes except 3posthog_flutter_web_handler_test.dart"app version" cases, which fail the same way onorigin/mainlocally (code this PR doesn't touch)../gradlew :posthog_flutter:testDebugUnitTest(48/48), including the newsetup_flutterVersion_addedOnlyToInstallAndUpdateEvents.xcodebuild test ... -only-testing:RunnerTests(5/5), including the newtestFlutterVersionAddedOnlyToInstallAndUpdateEvents, which runs the block through a realPostHogSDKcapture.flutterVersionkey ignored orApplication Updateddropped; iOSApplication Updateddropped).make checkFormatDart analyzeDart checkFormatKotlin checkFormatSwift checkApiDartall pass.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code. Options considered:
beforeSendalready covers it, with no new native API.🤖 Generated with Claude Code