Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/v6-hide-serialization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"posthog_flutter": major
---

- **Breaking:** remove `toMap()` from the config classes and `PostHogFeatureFlagResult.fromMap()` from the public API — they serialize the internal platform-channel wire format and were never meant for app code
115 changes: 0 additions & 115 deletions api/posthog_flutter.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2064,18 +2064,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "toMap",
"parameters": [],
"relativePath": "lib/src/posthog_config.dart",
"returnTypeName": "Map<String, dynamic>",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down Expand Up @@ -2421,18 +2409,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "toMap",
"parameters": [],
"relativePath": "lib/src/posthog_config.dart",
"returnTypeName": "Map<String, Object>",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down Expand Up @@ -2623,18 +2599,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "toMap",
"parameters": [],
"relativePath": "lib/src/posthog_config.dart",
"returnTypeName": "Map<String, dynamic>",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down Expand Up @@ -2913,18 +2877,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "toMap",
"parameters": [],
"relativePath": "lib/src/posthog_config.dart",
"returnTypeName": "Map<String, dynamic>",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down Expand Up @@ -3066,18 +3018,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "toMap",
"parameters": [],
"relativePath": "lib/src/posthog_config.dart",
"returnTypeName": "Map<String, Object>",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down Expand Up @@ -3131,18 +3071,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "toMap",
"parameters": [],
"relativePath": "lib/src/posthog_config.dart",
"returnTypeName": "Map<String, dynamic>",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down Expand Up @@ -3295,18 +3223,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "toMap",
"parameters": [],
"relativePath": "lib/src/posthog_config.dart",
"returnTypeName": "Map<String, Object?>",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down Expand Up @@ -3515,37 +3431,6 @@
"posthog_flutter.dart"
],
"executableDeclarations": [
{
"entryPoints": [],
"isDeprecated": false,
"isExperimental": false,
"isStatic": true,
"name": "fromMap",
"parameters": [
{
"isDeprecated": false,
"isExperimental": false,
"isNamed": false,
"isRequired": true,
"name": "result",
"relativePath": "lib/src/feature_flag_result.dart",
"typeName": "Object?"
},
{
"isDeprecated": false,
"isExperimental": false,
"isNamed": false,
"isRequired": true,
"name": "fallbackKey",
"relativePath": "lib/src/feature_flag_result.dart",
"typeName": "String"
}
],
"relativePath": "lib/src/feature_flag_result.dart",
"returnTypeName": "PostHogFeatureFlagResult?",
"type": "method",
"typeParameterNames": []
},
{
"entryPoints": [],
"isDeprecated": false,
Expand Down
3 changes: 2 additions & 1 deletion posthog_flutter/lib/posthog_flutter_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:posthog_flutter/src/error_tracking/dart_exception_processor.dart';
import 'package:posthog_flutter/src/util/logging.dart';
import 'package:posthog_flutter/src/utils/channel_serialization.dart';
import 'package:posthog_flutter/src/utils/property_normalizer.dart';

import 'src/feature_flag_result.dart';
Expand Down Expand Up @@ -413,7 +414,7 @@ class PosthogFlutterWeb extends PosthogFlutterPlatformInterface {
);

// Web SDK returns: { key, enabled, variant, payload }
return PostHogFeatureFlagResult.fromMap(result, key);
return featureFlagResultFromMap(result, key);
}

@override
Expand Down
19 changes: 0 additions & 19 deletions posthog_flutter/lib/src/feature_flag_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,4 @@ class PostHogFeatureFlagResult {

@override
int get hashCode => Object.hash(key, enabled, variant);

/// Creates a [PostHogFeatureFlagResult] from a native SDK response map.
///
/// The [result] should be a map containing `key`, `enabled`, `variant`, and
/// `payload` entries. Falls back to [fallbackKey] if the map does not include
/// a key.
///
/// Returns `null` if [result] is `null` or is not a [Map].
static PostHogFeatureFlagResult? fromMap(Object? result, String fallbackKey) {
if (result == null) return null;
if (result is! Map) return null;

return PostHogFeatureFlagResult(
key: result['key'] as String? ?? fallbackKey,
enabled: result['enabled'] as bool? ?? false,
variant: result['variant'] as String?,
payload: result['payload'],
);
}
}
Loading
Loading