From af6b1be7501273bde7091281c2fccedf76b4598c Mon Sep 17 00:00:00 2001 From: Anna Garcia Date: Wed, 7 Oct 2026 11:47:20 -0400 Subject: [PATCH 1/2] chore!: rename platform enable/disable to optIn/optOut PosthogFlutterPlatformInterface.enable()/disable() become optIn()/optOut() to match the public Posthog API renamed in #636/#638. The method-channel names sent to native stay 'enable'/'disable'. Co-Authored-By: Claude Opus 5.5 (1M context) --- .changeset/v6-platform-opt-in-out.md | 5 +++++ api/posthog_flutter.api.json | 8 ++++---- posthog_flutter/lib/posthog_flutter_web.dart | 4 ++-- posthog_flutter/lib/src/posthog.dart | 4 ++-- posthog_flutter/lib/src/posthog_flutter_io.dart | 4 ++-- .../lib/src/posthog_flutter_platform_interface.dart | 8 ++++---- .../test/posthog_flutter_platform_interface_fake.dart | 4 ++-- 7 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 .changeset/v6-platform-opt-in-out.md diff --git a/.changeset/v6-platform-opt-in-out.md b/.changeset/v6-platform-opt-in-out.md new file mode 100644 index 00000000..b1251018 --- /dev/null +++ b/.changeset/v6-platform-opt-in-out.md @@ -0,0 +1,5 @@ +--- +"posthog_flutter": major +--- + +- **Breaking:** rename `PosthogFlutterPlatformInterface.enable()` and `disable()` to `optIn()` and `optOut()`. Only affects custom platform implementations and test fakes that override them diff --git a/api/posthog_flutter.api.json b/api/posthog_flutter.api.json index 459d349e..072b73e4 100644 --- a/api/posthog_flutter.api.json +++ b/api/posthog_flutter.api.json @@ -565,7 +565,7 @@ "isDeprecated": false, "isExperimental": false, "isStatic": false, - "name": "disable", + "name": "optOut", "parameters": [], "relativePath": "lib/src/posthog_flutter_platform_interface.dart", "returnTypeName": "Future", @@ -577,7 +577,7 @@ "isDeprecated": false, "isExperimental": false, "isStatic": false, - "name": "enable", + "name": "optIn", "parameters": [], "relativePath": "lib/src/posthog_flutter_platform_interface.dart", "returnTypeName": "Future", @@ -1526,7 +1526,7 @@ "isDeprecated": false, "isExperimental": false, "isStatic": false, - "name": "disable", + "name": "optOut", "parameters": [], "relativePath": "lib/src/posthog_flutter_platform_interface.dart", "returnTypeName": "Future", @@ -1538,7 +1538,7 @@ "isDeprecated": false, "isExperimental": false, "isStatic": false, - "name": "enable", + "name": "optIn", "parameters": [], "relativePath": "lib/src/posthog_flutter_platform_interface.dart", "returnTypeName": "Future", diff --git a/posthog_flutter/lib/posthog_flutter_web.dart b/posthog_flutter/lib/posthog_flutter_web.dart index 0c718f0e..91fb2542 100644 --- a/posthog_flutter/lib/posthog_flutter_web.dart +++ b/posthog_flutter/lib/posthog_flutter_web.dart @@ -298,12 +298,12 @@ class PosthogFlutterWeb extends PosthogFlutterPlatformInterface { } @override - Future disable() async { + Future optOut() async { return handleWebMethodCall(const MethodCall('disable')); } @override - Future enable() async { + Future optIn() async { return handleWebMethodCall(const MethodCall('enable')); } diff --git a/posthog_flutter/lib/src/posthog.dart b/posthog_flutter/lib/src/posthog.dart index 847cbcec..18e23de4 100644 --- a/posthog_flutter/lib/src/posthog.dart +++ b/posthog_flutter/lib/src/posthog.dart @@ -383,7 +383,7 @@ class Posthog { // Uninstall Flutter-specific integrations when opting out _uninstallFlutterIntegrations(); - return _posthog.disable(); + return _posthog.optOut(); } /// Opts the current user back in to data collection. @@ -395,7 +395,7 @@ class Posthog { _installFlutterIntegrations(config); } - return _posthog.enable(); + return _posthog.optIn(); } /// Returns whether the current user has opted out of data collection. diff --git a/posthog_flutter/lib/src/posthog_flutter_io.dart b/posthog_flutter/lib/src/posthog_flutter_io.dart index 50f0ba19..bb8fb604 100644 --- a/posthog_flutter/lib/src/posthog_flutter_io.dart +++ b/posthog_flutter/lib/src/posthog_flutter_io.dart @@ -475,7 +475,7 @@ class PosthogFlutterIO extends PosthogFlutterPlatformInterface { } @override - Future disable() async { + Future optOut() async { if (!isSupportedPlatform()) { return; } @@ -488,7 +488,7 @@ class PosthogFlutterIO extends PosthogFlutterPlatformInterface { } @override - Future enable() async { + Future optIn() async { if (!isSupportedPlatform()) { return; } diff --git a/posthog_flutter/lib/src/posthog_flutter_platform_interface.dart b/posthog_flutter/lib/src/posthog_flutter_platform_interface.dart index 4c865355..a32de679 100644 --- a/posthog_flutter/lib/src/posthog_flutter_platform_interface.dart +++ b/posthog_flutter/lib/src/posthog_flutter_platform_interface.dart @@ -129,12 +129,12 @@ abstract class PosthogFlutterPlatformInterface extends PlatformInterface { throw UnimplementedError('reset() has not been implemented.'); } - Future disable() { - throw UnimplementedError('disable() has not been implemented.'); + Future optOut() { + throw UnimplementedError('optOut() has not been implemented.'); } - Future enable() { - throw UnimplementedError('enable() has not been implemented.'); + Future optIn() { + throw UnimplementedError('optIn() has not been implemented.'); } Future isOptOut() { diff --git a/posthog_flutter/test/posthog_flutter_platform_interface_fake.dart b/posthog_flutter/test/posthog_flutter_platform_interface_fake.dart index 2fad6e75..f3d41eda 100644 --- a/posthog_flutter/test/posthog_flutter_platform_interface_fake.dart +++ b/posthog_flutter/test/posthog_flutter_platform_interface_fake.dart @@ -228,10 +228,10 @@ class PosthogFlutterPlatformFake extends PosthogFlutterPlatformInterface { } @override - Future disable() async {} + Future optOut() async {} @override - Future enable() async {} + Future optIn() async {} @override Future close() async { From 43179f4265edd4baabdfa13697b9e07b1f4dab35 Mon Sep 17 00:00:00 2001 From: Anna Garcia Date: Wed, 7 Oct 2026 14:01:48 -0400 Subject: [PATCH 2/2] docs(changeset): cover direct platform callers in the opt-in/out rename Co-Authored-By: Claude Opus 5.5 (1M context) --- .changeset/v6-platform-opt-in-out.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/v6-platform-opt-in-out.md b/.changeset/v6-platform-opt-in-out.md index b1251018..0bdcaddf 100644 --- a/.changeset/v6-platform-opt-in-out.md +++ b/.changeset/v6-platform-opt-in-out.md @@ -2,4 +2,4 @@ "posthog_flutter": major --- -- **Breaking:** rename `PosthogFlutterPlatformInterface.enable()` and `disable()` to `optIn()` and `optOut()`. Only affects custom platform implementations and test fakes that override them +- **Breaking:** rename `enable()`/`disable()` to `optIn()`/`optOut()` on `PosthogFlutterPlatformInterface`, `PosthogFlutterIO` and `PosthogFlutterWeb`. Update direct calls to these platform classes, custom implementations, and test fakes/mocks. Calls to `Posthog().optIn()`/`optOut()` are unchanged