文件最后提交记录最后更新时间
[all] Omit obvious local types (#10511) Makes the analysis options changes described in https://github.com/flutter/flutter/issues/178827: - Adding [omit_obvious_local_variable_types](https://dart.dev/tools/linter-rules/omit_obvious_local_variable_types) - Adding [specify_nonobvious_local_variable_types](https://dart.dev/tools/linter-rules/specify_nonobvious_local_variable_types) - Adding [specify_nonobvious_property_types](https://dart.dev/tools/linter-rules/specify_nonobvious_property_types) - Adding [type_annotate_public_apis](https://dart.dev/tools/linter-rules/type_annotate_public_apis) - Removing [always_specify_types](https://dart.dev/tools/linter-rules/always_specify_types) After those changes, makes the following repo-wide changes: - dart fix --apply in all packages and in script/tool/ - dart format in all packages and in script/tool/ - update-excerpts repo tooling command to update excerpts based on the changes to their sources Also updates the min Flutter/Dart SDK version to 3.35/3.9 for the following packages, to avoid analyze failures in the N-2 legacy analysis run due to what appears to be a 3.9 change in what the Dart analyzer continues to be an obvious local type in loop iterations: - go_router - google_fonts - google_identity_services_web - google_maps_flutter_web - local_auth_platform_interface - metrics_center - multicast_dns - pigeon - rfw - shared_preferences - two_dimensional_scrollables - vector_graphics_compiler - mustache_template - path_parsing Because this is causing a significant amount of format churn already, I took this opportunity to update the repository tooling to a min Dart SDK of 3.8 (the N-2 stable version, so the earliest version we need the tooling to support) to pick up the new format style, so the amount of automated formatter change is higher in script/tool/ than in the packages. This does contain two manual changes (other than the repo tooling min version): - https://github.com/flutter/packages/commit/d700b45c7df3a79f66dc119ad36dd2bc1e042acf changes dynamic to Object? in a few places where dynamic caused analyzer warnings under the new rule set. - Updates the repo tooling to ignore .dart_tool/ when looking for unexpected local analysis_options.yaml files, to fix issues running the repo tool's analyze command locally based on recent changes in dart behavior. This does not include any CHANGELOG or version updates; even though we normally version any changes to production code, mass automated changes like this aren't worth the churn of releasing. This includes changes to lib/example/main.dart and to README.md excerpts; while the style changes will be user-visible on pub.dev, it's fine for those changes to wait for the next release of each package. Part of https://github.com/flutter/flutter/issues/1788276 个月前
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
Add a plugin_platform_interface package (#2348) Adds a package with a common base class for platform interface. The PlatformInterface class provides common functionality for enforcing that platform implementations extend the platform interface with extends rather than implement it with implements. This is based on the existing code from the url_laucher_platform_interface, and the improvements proposed in #23266 年前
Add a plugin_platform_interface package (#2348) Adds a package with a common base class for platform interface. The PlatformInterface class provides common functionality for enforcing that platform implementations extend the platform interface with extends rather than implement it with implements. This is based on the existing code from the url_laucher_platform_interface, and the improvements proposed in #23266 年前
Standardize Copyrights: Chromium->Flutter (#2996) In all copyright messages (and in the Xcode project organization name) standardize on "The Flutter Authors", adding "The Chromium Authors" to the Flutter AUTHORS list. This reduces inconsistency in the copyright lines in this repository, moving closer to a single consistent copyright+license (as in flutter/engine and flutter/flutter) Updates the validation script to no longer accept "The Chromium Authors" or "the Chromium project authors" in first-party code.5 年前
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
[plugin_platform_interface] Adopt code-excerpts (#4534) Updates the README to use code excerpts from the unit test file, adjusting the existing test code slightly to make it suitable for use in the example. Also fleshes out the example a bit more, to make it look more like a real class. Finally, adds a note about base, linking to the ongoing discussion, since we don't have a decision yet, but people may well wonder why this class exists given base. Part of https://github.com/flutter/flutter/issues/1026792 年前
[various] Disable sandbox in Chrome dart tests (#8909) flutter test automatically disables sandbox in headless mode, but dart test does not, and the Linux CI bots no longer support the sandbox, so this turns it off explicitly for packages that don't rely on Flutter (and thus use dart test). Fixes https://github.com/flutter/flutter/issues/1656641 年前
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
README.md

plugin_platform_interface

This package provides a base class for platform interfaces of federated flutter plugins.

Platform implementations should extends their platform interface class rather than implements it, as newly added methods to platform interfaces are not considered breaking changes. Extending a platform interface ensures that subclasses will get the default implementations from the base class, while platform implementations that implements their platform interface will be broken by newly added methods.

This class package provides common functionality for platform interface to enforce that they are extended and not implemented.

Sample usage:

abstract class SamplePluginPlatform extends PlatformInterface {
  SamplePluginPlatform() : super(token: _token);

  static final Object _token = Object();

  // A plugin can have a default implementation, as shown here, or `instance`
  // can be nullable, and the default instance can be null.
  static SamplePluginPlatform _instance = SamplePluginDefault();

  static SamplePluginPlatform get instance => _instance;

  /// Platform-specific implementations should set this to their own
  /// platform-specific class that extends [SamplePluginPlatform] when they
  /// register themselves.
  static set instance(SamplePluginPlatform instance) {
    PlatformInterface.verify(instance, _token);
    _instance = instance;
  }

  // Methods for the plugin's platform interface would go here, often with
  // implementations that throw UnimplementedError.
}

class SamplePluginDefault extends SamplePluginPlatform {
  // A default real implementation of the platform interface would go here.
}

This guarantees that UrlLauncherPlatform.instance cannot be set to an object that implements UrlLauncherPlatform (it can only be set to an object that extends UrlLauncherPlatform).

Mocking or faking platform interfaces

Test implementations of platform interfaces, such as those using mockito's Mock or test's Fake, will fail the verification done by verify. This package provides a MockPlatformInterfaceMixin which can be used in test code only to disable the extends enforcement.

For example, a Mockito mock of a platform interface can be created with:

class SamplePluginPlatformMock extends Mock
    with MockPlatformInterfaceMixin
    implements SamplePluginPlatform {}

A note about base

In Dart 3, the base keyword was introduced to the language, which enforces that subclasses use extends rather than implements at compile time. The Flutter team is considering deprecating this package in favor of using base for platfom interfaces, but no decision has been made yet since it removes the ability to do mocking/faking as shown above.

Plugin authors may want to consider using base instead of this package when creating new plugins.

https://github.com/flutter/flutter/issues/127396