Repository navigation
chore!: remove serialization helpers from the public API - #646
Merged
Merged
Conversation
toMap() on the config classes and PostHogFeatureFlagResult.fromMap() are the platform-channel wire format, not a user-facing data shape. Move them to extensions and a top-level function in an unexported src/utils/channel_serialization.dart so they drop out of the public API. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
posthog-flutter Compliance ReportDate: 2026-10-07 15:53:28 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
|
dustinbyrne
approved these changes
Oct 7, 2026
turnipdabeets
added a commit
that referenced
this pull request
Oct 7, 2026
toMap() on the config classes and PostHogFeatureFlagResult.fromMap() are the platform-channel wire format, not a user-facing data shape. Move them to extensions and a top-level function in an unexported src/utils/channel_serialization.dart so they drop out of the public API. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
5 tasks done
turnipdabeets
added a commit
that referenced
this pull request
Oct 8, 2026
toMap() on the config classes and PostHogFeatureFlagResult.fromMap() are the platform-channel wire format, not a user-facing data shape. Move them to extensions and a top-level function in an unexported src/utils/channel_serialization.dart so they drop out of the public API. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
Stacked on #637 (v6).
toMap()onPostHogConfig,PostHogBootstrapConfig,PostHogLogsConfig,PostHogRageClickConfig,PostHogSessionReplayConfig,PostHogErrorTrackingConfigandPostHogExceptionStepsConfig, plusPostHogFeatureFlagResult.fromMap(), are the platform-channel wire format, not a data shape for app code. For example,toMap()writessendFeatureFlagEventsfor thesendFeatureFlagEventfield. Because they're public, they're in the API snapshot and we'd have to keep them stable. A GitHub code search turned up no external callers. v6 is the place to drop them.What changed:
toMap()methods are now extensions, andfromMapis now a top-levelfeatureFlagResultFromMap(). Both live inlib/src/utils/channel_serialization.dart, whichlib/posthog_flutter.dartdoesn't export. The map bodies are unchanged.posthog_flutter_io.dart,posthog_flutter_web.dartand the tests import that file.PostHogFeatureFlagResultconstructor stays public.api/posthog_flutter.api.json. The only removals are the seventoMapentries andfromMap.Judgment calls:
@internal? The snapshot tool keeps@internalmembers (Posthog.configandcurrentScreenare still listed). Making the methods_privatedoesn't work either, because they're called from other libraries. Extensions in a file that isn't exported take them out of the API surface.PostHogLogsConfig.toMap()used a private member, the static helper_wholeSeconds. It moved into the extension with it. Every other field it reads, such ashost,screenshotScaleandscreenshotCompressionQuality, has a public getter.posthog_config.dartno longer needs itsutil/logging.dartimport. That import was only there for the bootstrap flag-type warning, which moved too.fromMapas a top-level function: a Dart extension can't add a static member that callers reach asPostHogFeatureFlagResult.fromMap. I also removed the redundantresult == nullcheck, sinceresult is! Mapalready covers null.v6-remove-5x-deprecations.md, so this doesn't conflict with the parallel platform opt-in/opt-out PR. That PR also regenerates the API snapshot, so whichever PR lands second needs to regenerate it again.💚 How did you test it?
flutter analyze: no issues. This coversposthog_flutter_web.dart.flutter test: all 781 tests passed. The existingtoMap/fromMaptests now run against the internal versions.dart format --set-exit-if-changed ./: clean.scripts/check-api-dart.sh --update: grepping the snapshot fortoMap,fromMap,SerializationandfeatureFlagResultFromMapreturns 0 matches.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Made with Claude Code. Anna chose the approach (unexported extensions instead of
@internal) after checking that the API snapshot keeps@internalmembers.🤖 Generated with Claude Code