diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index 166eb4767c..a1adda894c 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart @@ -310,7 +310,7 @@ class FlutterProject { bool winUwpPlatform = false, DeprecationBehavior deprecationBehavior = DeprecationBehavior.none, }) async { - if (!directory.existsSync() || hasExampleApp || isPlugin) { + if (!directory.existsSync() || 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 0214d3d847..ca2b583506 100644 --- a/packages/flutter_tools/test/general.shard/project_test.dart +++ b/packages/flutter_tools/test/general.shard/project_test.dart @@ -156,6 +156,18 @@ void main() { expectNotExists(project.ios.hostAppRoot.childDirectory('Flutter').childFile('Generated.xcconfig')); expectNotExists(project.android.hostAppGradleRoot.childFile('local.properties')); }); + _testInMemory('works if there is an "example" folder', () async { + final FlutterProject project = await someProject(); + // The presence of an "example" folder used to be used as an indicator + // that a project was a plugin, but shouldn't be as this creates false + // positives. + project.directory.childDirectory('example').createSync(); + await project.regeneratePlatformSpecificTooling(); + expectExists(project.ios.hostAppRoot.childDirectory('Runner').childFile('GeneratedPluginRegistrant.h')); + expectExists(androidPluginRegistrant(project.android.hostAppGradleRoot.childDirectory('app'))); + expectExists(project.ios.hostAppRoot.childDirectory('Flutter').childFile('Generated.xcconfig')); + expectExists(project.android.hostAppGradleRoot.childFile('local.properties')); + }); _testInMemory('injects plugins for iOS', () async { final FlutterProject project = await someProject(); await project.regeneratePlatformSpecificTooling();