This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +10
-10
lines changed
packages/plugin_platform_interface Expand file tree Collapse file tree 5 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1+ ## 1.0.1
2+
3+ * Fixed a bug that made all platform interfaces appear as mocks in release builds (https://github.com/flutter/flutter/issues/46941 ).
4+
15## 1.0.0 - Initial release.
26
37* Provides ` PlatformInterface ` with common mechanism for enforcing that a platform interface
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ abstract class UrlLauncherPlatform extends PlatformInterface {
1818
1919 static UrlLauncherPlatform _instance = MethodChannelUrlLauncher();
2020
21- static const Object _token = Object();
21+ static final Object _token = Object();
2222
2323 static UrlLauncherPlatform get instance => _instance;
2424
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ abstract class PlatformInterface {
5757 /// This is implemented as a static method so that it cannot be overridden
5858 /// with `noSuchMethod` .
5959 static void verifyToken (PlatformInterface instance, Object token) {
60- if (identical ( instance._instanceToken, MockPlatformInterfaceMixin ._token) ) {
60+ if (instance is MockPlatformInterfaceMixin ) {
6161 bool assertionsEnabled = false ;
6262 assert (() {
6363 assertionsEnabled = true ;
@@ -67,6 +67,7 @@ abstract class PlatformInterface {
6767 throw AssertionError (
6868 '`MockPlatformInterfaceMixin` is not intended for use in release builds.' );
6969 }
70+ return ;
7071 }
7172 if (! identical (token, instance._instanceToken)) {
7273 throw AssertionError (
@@ -90,9 +91,4 @@ abstract class PlatformInterface {
9091/// implements UrlLauncherPlatform {}
9192/// ```
9293@visibleForTesting
93- abstract class MockPlatformInterfaceMixin implements PlatformInterface {
94- static const Object _token = Object ();
95-
96- @override
97- Object get _instanceToken => _token;
98- }
94+ abstract class MockPlatformInterfaceMixin implements PlatformInterface {}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ description: Reusable base class for Flutter plugin platform interfaces.
1212# be done when absolutely necessary and after the ecosystem has already migrated to 1.X.Y version
1313# that is forward compatible with 2.0.0 (ideally the ecosystem have migrated to depend on:
1414# `plugin_platform_interface: >=1.X.Y <3.0.0`).
15- version : 1.0.0
15+ version : 1.0.1
1616
1717homepage : https://github.com/flutter/plugins/plugin_platform_interface
1818
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart';
1010class SamplePluginPlatform extends PlatformInterface {
1111 SamplePluginPlatform () : super (token: _token);
1212
13- static const Object _token = Object ();
13+ static final Object _token = Object ();
1414
1515 static set instance (SamplePluginPlatform instance) {
1616 PlatformInterface .verifyToken (instance, _token);
You can’t perform that action at this time.
0 commit comments