Do not show plugin embedding warning with missing example app (#76406)
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart
index 0e164aa..06ed097 100644
--- a/packages/flutter_tools/lib/src/project.dart
+++ b/packages/flutter_tools/lib/src/project.dart
@@ -217,6 +217,9 @@
/// True if this project is a Flutter module project.
bool get isModule => manifest.isModule;
+ /// True if this project is a Flutter plugin project.
+ bool get isPlugin => manifest.isPlugin;
+
/// True if the Flutter project is using the AndroidX support library.
bool get usesAndroidX => manifest.usesAndroidX;
@@ -285,7 +288,7 @@
bool windowsPlatform = false,
bool webPlatform = false,
}) async {
- if (!directory.existsSync() || hasExampleApp) {
+ if (!directory.existsSync() || hasExampleApp || isPlugin) {
return;
}
await refreshPluginsList(this, iosPlatform: iosPlatform, macOSPlatform: macOSPlatform);
diff --git a/packages/flutter_tools/test/general.shard/project_test.dart b/packages/flutter_tools/test/general.shard/project_test.dart
index 729ddff..546b1ec 100644
--- a/packages/flutter_tools/test/general.shard/project_test.dart
+++ b/packages/flutter_tools/test/general.shard/project_test.dart
@@ -185,6 +185,13 @@
await project.regeneratePlatformSpecificTooling();
expect(testLogger.statusText, contains('https://flutter.dev/go/android-project-migration'));
});
+ _testInMemory('Android plugin without example app does not show a warning', () async {
+ final FlutterProject project = await aPluginProject();
+ project.example.directory.deleteSync();
+
+ await project.regeneratePlatformSpecificTooling();
+ expect(testLogger.statusText, isNot(contains('https://flutter.dev/go/android-project-migration')));
+ });
_testInMemory('updates local properties for Android', () async {
final FlutterProject project = await someProject();
await project.regeneratePlatformSpecificTooling();
@@ -306,6 +313,7 @@
group('example', () {
_testInMemory('exists for plugin in legacy format', () async {
final FlutterProject project = await aPluginProject();
+ expect(project.isPlugin, isTrue);
expect(project.hasExampleApp, isTrue);
});
_testInMemory('exists for plugin in multi-platform format', () async {
@@ -314,6 +322,7 @@
});
_testInMemory('does not exist for non-plugin', () async {
final FlutterProject project = await someProject();
+ expect(project.isPlugin, isFalse);
expect(project.hasExampleApp, isFalse);
});
});