From f711e20158bfe4b5cf07f5bf7c4c8ebb01aff98f Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Tue, 3 Aug 2021 20:13:14 -0400 Subject: [PATCH 01/11] Updates documentation for `PlatformInterface`. --- packages/plugin_platform_interface/CHANGELOG.md | 4 ++++ .../lib/plugin_platform_interface.dart | 6 +++--- packages/plugin_platform_interface/pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index af79d119c5f6..2455eddaf100 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.3 + +* Update documentation. + ## 2.0.2 * Update package description. diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index d9bd88168422..169b74ebc732 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -22,7 +22,7 @@ import 'package:meta/meta.dart'; /// /// static UrlLauncherPlatform _instance = MethodChannelUrlLauncher(); /// -/// static const Object _token = Object(); +/// static final Object _token = Object(); /// /// static UrlLauncherPlatform get instance => _instance; /// @@ -40,7 +40,7 @@ import 'package:meta/meta.dart'; /// to include the [MockPlatformInterfaceMixin] for the verification to be temporarily disabled. See /// [MockPlatformInterfaceMixin] for a sample of using Mockito to mock a platform interface. abstract class PlatformInterface { - /// Pass a private, class-specific `const Object()` as the `token`. + /// Pass a private, class-specific `Object()` as the `token`. PlatformInterface({required Object token}) : _instanceToken = token; final Object? _instanceToken; @@ -83,7 +83,7 @@ abstract class PlatformInterface { /// /// This class is intended for use in tests only. /// -/// Sample usage (assuming UrlLauncherPlatform extends [PlatformInterface]: +/// Sample usage (assuming `UrlLauncherPlatform` extends [PlatformInterface]): /// /// ```dart /// class UrlLauncherPlatformMock extends Mock diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index 0b4b1782b526..b46483d80f83 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -15,7 +15,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ # be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version # that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: # `plugin_platform_interface: >=1.X.Y <3.0.0`). -version: 2.0.2 +version: 2.0.3 environment: sdk: ">=2.12.0 <3.0.0" From a6a897c892a097be48416d6af48ca4770b3967fd Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 08:20:51 -0800 Subject: [PATCH 02/11] Implement feedback on https://github.com/flutter/flutter/issues/96178 --- packages/plugin_platform_interface/CHANGELOG.md | 3 ++- .../lib/plugin_platform_interface.dart | 1 + packages/plugin_platform_interface/pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index 2455eddaf100..34d2bd437dfe 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,5 +1,6 @@ -## 2.0.3 +## 2.1.0 +* Assert that `const Object()` is not used as the token. * Update documentation. ## 2.0.2 diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index 169b74ebc732..7c509a975a21 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -57,6 +57,7 @@ abstract class PlatformInterface { /// This is implemented as a static method so that it cannot be overridden /// with `noSuchMethod`. static void verifyToken(PlatformInterface instance, Object token) { + assert(token != const Object()); if (instance is MockPlatformInterfaceMixin) { bool assertionsEnabled = false; assert(() { diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index b46483d80f83..6a44cec55663 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -15,7 +15,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ # be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version # that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: # `plugin_platform_interface: >=1.X.Y <3.0.0`). -version: 2.0.3 +version: 2.1.0 environment: sdk: ">=2.12.0 <3.0.0" From d047d042dafe8049a0ad34ff67144f866c758fc9 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 08:21:07 -0800 Subject: [PATCH 03/11] Fix comment to reflect that version 2 was already released. --- packages/plugin_platform_interface/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index 6a44cec55663..318f11d20dec 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -9,7 +9,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ # # This package is used as a second level dependency for many plugins, a major version bump here # is guaranteed to lead the ecosystem to a version lock (the first plugin that upgrades to version -# 2 of this package cannot be used with any other plugin that have not yet migrated). +# 3 of this package cannot be used with any other plugin that have not yet migrated). # # Please consider carefully before bumping the major version of this package, ideally it should only # be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version From 77f84a402c332d9873b76a0c923837fc2f527bf9 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 08:30:48 -0800 Subject: [PATCH 04/11] Add a test --- .../test/plugin_platform_interface_test.dart | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 967fa79d6dc3..2a970f045274 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -26,6 +26,18 @@ class ImplementsSamplePluginPlatformUsingMockPlatformInterfaceMixin extends Mock class ExtendsSamplePluginPlatform extends SamplePluginPlatform {} +class InvalidPluginPlatform extends PlatformInterface { + SamplePluginPlatform() : super(token: _token); + + const Object _token = Object(); + + static set instance(SamplePluginPlatform instance) { + PlatformInterface.verifyToken(instance, _token); + } +} + +class ExtendsInvalidPluginPlatform extends InvalidPluginPlatform {} + void main() { test('Cannot be implemented with `implements`', () { expect(() { @@ -41,5 +53,11 @@ void main() { test('Can be extended', () { SamplePluginPlatform.instance = ExtendsSamplePluginPlatform(); - }); + ); + + test('Cannot use `const Object()` as token', () { + expect(() { + InvalidPluginPlatform.instance = ExtendsInvalidPluginPlatform(); + }, throwsA(isA Date: Wed, 5 Jan 2022 10:59:08 -0800 Subject: [PATCH 05/11] Introduced a new method `verifyExtends` and soft-deprecated `verifyToken`. --- .../plugin_platform_interface/CHANGELOG.md | 3 ++- .../lib/plugin_platform_interface.dart | 24 +++++++++++++++---- .../test/plugin_platform_interface_test.dart | 22 ++++++++--------- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index 34d2bd437dfe..51c524d0beae 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,6 +1,7 @@ ## 2.1.0 -* Assert that `const Object()` is not used as the token. +* Add a new static method `verifyExtends`, preventing use of `const Object()` as instance token. +* Soft deprecate `verifyToken`, to avoid breaking tests that check for use of deprecated APIs. * Update documentation. ## 2.0.2 diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index 7c509a975a21..a9ce84d3f4d9 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -29,7 +29,7 @@ import 'package:meta/meta.dart'; /// /// Platform-specific plugins should set this with their own platform-specific /// /// class that extends [UrlLauncherPlatform] when they register themselves. /// static set instance(UrlLauncherPlatform instance) { -/// PlatformInterface.verifyToken(instance, _token); +/// PlatformInterface.verifyExtends(instance, _token); /// _instance = instance; /// } /// @@ -40,12 +40,14 @@ import 'package:meta/meta.dart'; /// to include the [MockPlatformInterfaceMixin] for the verification to be temporarily disabled. See /// [MockPlatformInterfaceMixin] for a sample of using Mockito to mock a platform interface. abstract class PlatformInterface { - /// Pass a private, class-specific `Object()` as the `token`. + /// Constructs a PlatformInterface, for use only in constructors of abstract derived classes. + /// + /// @param token A non-`const` `Object` used to verify that implementations use `extends`. PlatformInterface({required Object token}) : _instanceToken = token; final Object? _instanceToken; - /// Ensures that the platform instance has a token that matches the + /// Ensures that the platform instance has a non-`const` token that matches the /// provided token and throws [AssertionError] if not. /// /// This is used to ensure that implementers are using `extends` rather than @@ -56,8 +58,22 @@ abstract class PlatformInterface { /// /// This is implemented as a static method so that it cannot be overridden /// with `noSuchMethod`. + static void verifyExtends(PlatformInterface instance, Object token) { + if (identical(instance._instanceToken, const Object())) { + throw AssertionError('`const Object()` cannot be used as `token`.'); + } + _verifyExtends(instance, token); + } + + /// Performs the same checks as `verifyExtends` but without throwing an + /// [AssertionError] if `const Object()` is used as the instance token. + /// + /// This method will be deprecated in a future release. static void verifyToken(PlatformInterface instance, Object token) { - assert(token != const Object()); + _verifyExtends(instance, token); + } + + static void _verifyExtends(PlatformInterface instance, Object token) { if (instance is MockPlatformInterfaceMixin) { bool assertionsEnabled = false; assert(() { 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 2a970f045274..6eb488a6f66a 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -12,7 +12,7 @@ class SamplePluginPlatform extends PlatformInterface { static final Object _token = Object(); static set instance(SamplePluginPlatform instance) { - PlatformInterface.verifyToken(instance, _token); + PlatformInterface.verifyExtends(instance, _token); // A real implementation would set a static instance field here. } } @@ -26,17 +26,17 @@ class ImplementsSamplePluginPlatformUsingMockPlatformInterfaceMixin extends Mock class ExtendsSamplePluginPlatform extends SamplePluginPlatform {} -class InvalidPluginPlatform extends PlatformInterface { - SamplePluginPlatform() : super(token: _token); +class ConstTokenPluginPlatform extends PlatformInterface { + ConstTokenPluginPlatform() : super(token: _token); - const Object _token = Object(); + static const Object _token = Object(); // invalid - static set instance(SamplePluginPlatform instance) { - PlatformInterface.verifyToken(instance, _token); + static set instance(ConstTokenPluginPlatform instance) { + PlatformInterface.verifyExtends(instance, _token); } } -class ExtendsInvalidPluginPlatform extends InvalidPluginPlatform {} +class ExtendsConstTokenPluginPlatform extends ConstTokenPluginPlatform {} void main() { test('Cannot be implemented with `implements`', () { @@ -53,11 +53,11 @@ void main() { test('Can be extended', () { SamplePluginPlatform.instance = ExtendsSamplePluginPlatform(); - ); + }); test('Cannot use `const Object()` as token', () { expect(() { - InvalidPluginPlatform.instance = ExtendsInvalidPluginPlatform(); - }, throwsA(isA())); + }); } From af1b67040297f7cf11b546709c0b4b0f927b8e42 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 11:13:52 -0800 Subject: [PATCH 06/11] Rename verifyExtends to the shorter verify. Update CHANGELOG. --- packages/plugin_platform_interface/CHANGELOG.md | 5 ++--- .../lib/plugin_platform_interface.dart | 12 ++++++------ .../test/plugin_platform_interface_test.dart | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/plugin_platform_interface/CHANGELOG.md b/packages/plugin_platform_interface/CHANGELOG.md index 51c524d0beae..950da032e10f 100644 --- a/packages/plugin_platform_interface/CHANGELOG.md +++ b/packages/plugin_platform_interface/CHANGELOG.md @@ -1,8 +1,7 @@ ## 2.1.0 -* Add a new static method `verifyExtends`, preventing use of `const Object()` as instance token. -* Soft deprecate `verifyToken`, to avoid breaking tests that check for use of deprecated APIs. -* Update documentation. +* Introduce `verify`, which prevents use of `const Object()` as instance token. +* Add a comment indicating that `verifyToken` will be deprecated in a future release. ## 2.0.2 diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index a9ce84d3f4d9..d929e0f67283 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -29,7 +29,7 @@ import 'package:meta/meta.dart'; /// /// Platform-specific plugins should set this with their own platform-specific /// /// class that extends [UrlLauncherPlatform] when they register themselves. /// static set instance(UrlLauncherPlatform instance) { -/// PlatformInterface.verifyExtends(instance, _token); +/// PlatformInterface.verify(instance, _token); /// _instance = instance; /// } /// @@ -58,22 +58,22 @@ abstract class PlatformInterface { /// /// This is implemented as a static method so that it cannot be overridden /// with `noSuchMethod`. - static void verifyExtends(PlatformInterface instance, Object token) { + static void verify(PlatformInterface instance, Object token) { if (identical(instance._instanceToken, const Object())) { throw AssertionError('`const Object()` cannot be used as `token`.'); } - _verifyExtends(instance, token); + _verify(instance, token); } - /// Performs the same checks as `verifyExtends` but without throwing an + /// Performs the same checks as `verify` but without throwing an /// [AssertionError] if `const Object()` is used as the instance token. /// /// This method will be deprecated in a future release. static void verifyToken(PlatformInterface instance, Object token) { - _verifyExtends(instance, token); + _verify(instance, token); } - static void _verifyExtends(PlatformInterface instance, Object token) { + static void _verify(PlatformInterface instance, Object token) { if (instance is MockPlatformInterfaceMixin) { bool assertionsEnabled = false; assert(() { 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 6eb488a6f66a..1aa0a8edc3f2 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -12,7 +12,7 @@ class SamplePluginPlatform extends PlatformInterface { static final Object _token = Object(); static set instance(SamplePluginPlatform instance) { - PlatformInterface.verifyExtends(instance, _token); + PlatformInterface.verify(instance, _token); // A real implementation would set a static instance field here. } } @@ -32,7 +32,7 @@ class ConstTokenPluginPlatform extends PlatformInterface { static const Object _token = Object(); // invalid static set instance(ConstTokenPluginPlatform instance) { - PlatformInterface.verifyExtends(instance, _token); + PlatformInterface.verify(instance, _token); } } From 6b6cad3fbfed4a01b1254db1e41940f038c6dd0d Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 11:25:26 -0800 Subject: [PATCH 07/11] Fix comments. Update assertion message. --- .../lib/plugin_platform_interface.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index d929e0f67283..dc9d3255d21b 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -12,7 +12,7 @@ import 'package:meta/meta.dart'; /// implemented using `extends` instead of `implements`. /// /// Platform interface classes are expected to have a private static token object which will be -/// be passed to [verifyToken] along with a platform interface object for verification. +/// be passed to [verify] along with a platform interface object for verification. /// /// Sample usage: /// @@ -40,15 +40,16 @@ import 'package:meta/meta.dart'; /// to include the [MockPlatformInterfaceMixin] for the verification to be temporarily disabled. See /// [MockPlatformInterfaceMixin] for a sample of using Mockito to mock a platform interface. abstract class PlatformInterface { - /// Constructs a PlatformInterface, for use only in constructors of abstract derived classes. + /// Constructs a PlatformInterface, for use only in constructors of abstract + /// derived classes. /// - /// @param token A non-`const` `Object` used to verify that implementations use `extends`. + /// @param token The same, non-`const` `Object` that will be passed to `verify`. PlatformInterface({required Object token}) : _instanceToken = token; final Object? _instanceToken; - /// Ensures that the platform instance has a non-`const` token that matches the - /// provided token and throws [AssertionError] if not. + /// Ensures that the platform instance was constructed with a non-`const` token + /// that matches the provided token and throws [AssertionError] if not. /// /// This is used to ensure that implementers are using `extends` rather than /// `implements`. @@ -60,7 +61,7 @@ abstract class PlatformInterface { /// with `noSuchMethod`. static void verify(PlatformInterface instance, Object token) { if (identical(instance._instanceToken, const Object())) { - throw AssertionError('`const Object()` cannot be used as `token`.'); + throw AssertionError('`const Object()` cannot be used as the instance token.'); } _verify(instance, token); } @@ -95,7 +96,7 @@ abstract class PlatformInterface { /// A [PlatformInterface] mixin that can be combined with mockito's `Mock`. /// -/// It passes the [PlatformInterface.verifyToken] check even though it isn't +/// It passes the [PlatformInterface.verify] check even though it isn't /// using `extends`. /// /// This class is intended for use in tests only. From 972fdf1f583a6a4b905f331158d6639b961b8777 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 12:19:19 -0800 Subject: [PATCH 08/11] Add tests for verifyToken --- .../test/plugin_platform_interface_test.dart | 75 +++++++++++++++---- 1 file changed, 59 insertions(+), 16 deletions(-) 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 1aa0a8edc3f2..a00462ffad50 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -38,26 +38,69 @@ class ConstTokenPluginPlatform extends PlatformInterface { class ExtendsConstTokenPluginPlatform extends ConstTokenPluginPlatform {} +class VerifyTokenPluginPlatform extends PlatformInterface { + VerifyTokenPluginPlatform() : super(token: _token); + + static final Object _token = Object(); + + static set instance(VerifyTokenPluginPlatform instance) { + PlatformInterface.verifyToken(instance, _token); + // A real implementation would set a static instance field here. + } +} + +class ImplementsVerifyTokenPluginPlatform extends Mock + implements VerifyTokenPluginPlatform {} + +class ImplementsVerifyTokenPluginPlatformUsingMockPlatformInterfaceMixin + extends Mock + with MockPlatformInterfaceMixin + implements VerifyTokenPluginPlatform {} + +class ExtendsVerifyTokenPluginPlatform extends VerifyTokenPluginPlatform {} + void main() { - test('Cannot be implemented with `implements`', () { - expect(() { - SamplePluginPlatform.instance = ImplementsSamplePluginPlatform(); - }, throwsA(isA())); - }); + group('`verify`', () { + test('prevents implementation with `implements`', () { + expect(() { + SamplePluginPlatform.instance = ImplementsSamplePluginPlatform(); + }, throwsA(isA())); + }); - test('Can be mocked with `implements`', () { - final SamplePluginPlatform mock = - ImplementsSamplePluginPlatformUsingMockPlatformInterfaceMixin(); - SamplePluginPlatform.instance = mock; - }); + test('allows mocking with `implements`', () { + final SamplePluginPlatform mock = + ImplementsSamplePluginPlatformUsingMockPlatformInterfaceMixin(); + SamplePluginPlatform.instance = mock; + }); + + test('allows extending', () { + SamplePluginPlatform.instance = ExtendsSamplePluginPlatform(); + }); - test('Can be extended', () { - SamplePluginPlatform.instance = ExtendsSamplePluginPlatform(); + test('prevents `const Object()` token', () { + expect(() { + ConstTokenPluginPlatform.instance = ExtendsConstTokenPluginPlatform(); + }, throwsA(isA())); + }); }); - test('Cannot use `const Object()` as token', () { - expect(() { - ConstTokenPluginPlatform.instance = ExtendsConstTokenPluginPlatform(); - }, throwsA(isA())); + // Tests of the earlier, to-be-deprecated `verifyToken` method + group('`verifyToken`', () { + test('prevents implementation with `implements`', () { + expect(() { + VerifyTokenPluginPlatform.instance = + ImplementsVerifyTokenPluginPlatform(); + }, throwsA(isA())); + }); + + test('allows mocking with `implements`', () { + final VerifyTokenPluginPlatform mock = + ImplementsVerifyTokenPluginPlatformUsingMockPlatformInterfaceMixin(); + VerifyTokenPluginPlatform.instance = mock; + }); + + test('allows extending', () { + VerifyTokenPluginPlatform.instance = ExtendsVerifyTokenPluginPlatform(); + }); }); } From 4ce276525959ec64c549f62047b018661d6a734b Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 12:19:50 -0800 Subject: [PATCH 09/11] Reduce line length for readability --- .../lib/plugin_platform_interface.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart index dc9d3255d21b..f12fd3c39cc7 100644 --- a/packages/plugin_platform_interface/lib/plugin_platform_interface.dart +++ b/packages/plugin_platform_interface/lib/plugin_platform_interface.dart @@ -61,7 +61,7 @@ abstract class PlatformInterface { /// with `noSuchMethod`. static void verify(PlatformInterface instance, Object token) { if (identical(instance._instanceToken, const Object())) { - throw AssertionError('`const Object()` cannot be used as the instance token.'); + throw AssertionError('`const Object()` cannot be used as the token.'); } _verify(instance, token); } From 2aa95523e4c61b46860e2712da69375c644e72f4 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 12:20:08 -0800 Subject: [PATCH 10/11] Update comment to reflect that this package had a major update --- packages/plugin_platform_interface/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index 318f11d20dec..62f50e169952 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -14,7 +14,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ # Please consider carefully before bumping the major version of this package, ideally it should only # be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version # that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: -# `plugin_platform_interface: >=1.X.Y <3.0.0`). +# `plugin_platform_interface: >=2.X.Y <4.0.0`). version: 2.1.0 environment: From 40a73add052d318df31889919756a66f9dcbfa3b Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Wed, 5 Jan 2022 12:33:25 -0800 Subject: [PATCH 11/11] More fixes to comment in pubspec.yaml --- packages/plugin_platform_interface/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin_platform_interface/pubspec.yaml b/packages/plugin_platform_interface/pubspec.yaml index 62f50e169952..0559b8daee8f 100644 --- a/packages/plugin_platform_interface/pubspec.yaml +++ b/packages/plugin_platform_interface/pubspec.yaml @@ -12,8 +12,8 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ # 3 of this package cannot be used with any other plugin that have not yet migrated). # # Please consider carefully before bumping the major version of this package, ideally it should only -# be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version -# that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on: +# be done when absolutely necessary and after the ecosystem has already migrated to 2.X.Y version +# that is forward compatible with 3.0.0 (ideally the ecosystem have migrated to depend on: # `plugin_platform_interface: >=2.X.Y <4.0.0`). version: 2.1.0