[plugin_platform_interface] Test that `PlatformInterface` and `MockPlatformInterfaceMixinTest` have no instance methods (#4659)
diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index 4f49842..72229cb 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md
@@ -1,3 +1,7 @@ +## NEXT + +* Adds additional tests for `PlatformInterface` and `MockPlatformInterfaceMixin`. + ## 2.1.2 * Updates README to demonstrate `verify` rather than `verifyToken`, and to note
diff --git a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart index d36f21c..9e1ddc0 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart
@@ -78,6 +78,14 @@ ImplementsConstVerifyTokenPluginPlatform() : super(token: const Object()); } +// Ensures that `PlatformInterface` has no instance methods. Adding an +// instance method is discouraged and may be a breaking change if it +// conflicts with instance methods in subclasses. +class StaticMethodsOnlyPlatformInterfaceTest implements PlatformInterface {} + +class StaticMethodsOnlyMockPlatformInterfaceMixinTest + implements MockPlatformInterfaceMixin {} + void main() { group('`verify`', () { test('prevents implementation with `implements`', () {