Skip iOS project migration when script is already embedding frameworks (#51963)

diff --git a/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart b/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart
index efc21ca..528239f 100644
--- a/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart
+++ b/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart
@@ -87,7 +87,7 @@
 
       // Embed and thin frameworks in a script instead of using Xcode's link / embed build phases.
       const String thinBinaryScript = 'xcode_backend.sh\\" thin';
-      if (line.contains(thinBinaryScript)) {
+      if (line.contains(thinBinaryScript) && !line.contains(' embed')) {
         return line.replaceFirst(thinBinaryScript, 'xcode_backend.sh\\" embed_and_thin');
       }
 
diff --git a/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart
index b39b1eb..6fc79e6 100644
--- a/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart
+++ b/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart
@@ -72,6 +72,22 @@
       expect(testLogger.statusText, isEmpty);
     });
 
+    testWithoutContext('skips migrating script with embed', () {
+      const String contents = '''
+shellScript = "/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" embed\\n/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" thin\n";
+			''';
+      xcodeProjectInfoFile.writeAsStringSync(contents);
+
+      final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
+        mockIosProject,
+        testLogger,
+        mockXcode,
+      );
+      expect(iosProjectMigration.migrate(), isTrue);
+      expect(xcodeProjectInfoFile.readAsStringSync(), contents);
+      expect(testLogger.statusText, isEmpty);
+    });
+
     testWithoutContext('Xcode project is migrated', () {
       xcodeProjectInfoFile.writeAsStringSync('''
 prefix 3B80C3941E831B6300D905FE