From f4da9f72ebf2060a0c2e638bff6c3384adea778f Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 8 Nov 2019 16:31:34 -0800 Subject: [PATCH] Deprecation cleanup in flutter_tools (#44469) One deprecated member was no longer used; removed it. The other probably shouldn't be deprecated, because it's not the parser that's deprecated so much as the format it's parsing. The code itself will live on until we decide to stop supporting the format, it's not like people calling the member should use something else. --- .../flutter_tools/lib/src/base/context.dart | 11 ----- packages/flutter_tools/lib/src/plugins.dart | 46 ++++++++++--------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/packages/flutter_tools/lib/src/base/context.dart b/packages/flutter_tools/lib/src/base/context.dart index e3f2438e76f..8dc8bbf39f8 100644 --- a/packages/flutter_tools/lib/src/base/context.dart +++ b/packages/flutter_tools/lib/src/base/context.dart @@ -117,17 +117,6 @@ class AppContext { return _unboxNull(value ?? _generateIfNecessary(T, _fallbacks)) as T; } - /// Gets the value associated with the specified [type], or `null` if no - /// such value has been associated. - @Deprecated('use get instead for type safety.') - Object operator [](Type type) { - dynamic value = _generateIfNecessary(type, _overrides); - if (value == null && _parent != null) { - value = _parent[type]; - } - return _unboxNull(value ?? _generateIfNecessary(type, _fallbacks)); - } - /// Runs [body] in a child context and returns the value returned by [body]. /// /// If [overrides] is specified, the child context will return corresponding diff --git a/packages/flutter_tools/lib/src/plugins.dart b/packages/flutter_tools/lib/src/plugins.dart index 613400cbfbc..19cdc1b8733 100644 --- a/packages/flutter_tools/lib/src/plugins.dart +++ b/packages/flutter_tools/lib/src/plugins.dart @@ -35,28 +35,31 @@ class Plugin { /// Parses [Plugin] specification from the provided pluginYaml. /// /// This currently supports two formats. Legacy and Multi-platform. + /// /// Example of the deprecated Legacy format. - /// flutter: - /// plugin: - /// androidPackage: io.flutter.plugins.sample - /// iosPrefix: FLT - /// pluginClass: SamplePlugin + /// + /// flutter: + /// plugin: + /// androidPackage: io.flutter.plugins.sample + /// iosPrefix: FLT + /// pluginClass: SamplePlugin /// /// Example Multi-platform format. - /// flutter: - /// plugin: - /// platforms: - /// android: - /// package: io.flutter.plugins.sample - /// pluginClass: SamplePlugin - /// ios: - /// pluginClass: SamplePlugin - /// linux: - /// pluginClass: SamplePlugin - /// macos: - /// pluginClass: SamplePlugin - /// windows: - /// pluginClass: SamplePlugin + /// + /// flutter: + /// plugin: + /// platforms: + /// android: + /// package: io.flutter.plugins.sample + /// pluginClass: SamplePlugin + /// ios: + /// pluginClass: SamplePlugin + /// linux: + /// pluginClass: SamplePlugin + /// macos: + /// pluginClass: SamplePlugin + /// windows: + /// pluginClass: SamplePlugin factory Plugin.fromYaml(String name, String path, dynamic pluginYaml) { final List errors = validatePluginYaml(pluginYaml); if (errors.isNotEmpty) { @@ -65,7 +68,7 @@ class Plugin { if (pluginYaml != null && pluginYaml['platforms'] != null) { return Plugin._fromMultiPlatformYaml(name, path, pluginYaml); } - return Plugin._fromLegacyYaml(name, path, pluginYaml); // ignore: deprecated_member_use_from_same_package + return Plugin._fromLegacyYaml(name, path, pluginYaml); } factory Plugin._fromMultiPlatformYaml(String name, String path, dynamic pluginYaml) { @@ -118,7 +121,6 @@ class Plugin { ); } - @deprecated factory Plugin._fromLegacyYaml(String name, String path, dynamic pluginYaml) { final Map platforms = {}; final String pluginClass = pluginYaml['pluginClass']; @@ -396,7 +398,7 @@ Future _writeAndroidPluginRegistrant(FlutterProject project, List case AndroidEmbeddingVersion.v2: templateContext['needsShim'] = false; // If a plugin is using an embedding version older than 2.0 and the app is using 2.0, - // then add shim for the old plugins. + // then add shim for the old plugins. for (Map plugin in androidPlugins) { if (plugin['supportsEmbeddingV1'] && !plugin['supportsEmbeddingV2']) { templateContext['needsShim'] = true;