Support create for macOS (app and plugin) (#40851)

Adds macOS support for `flutter create`:
- Currently it is behind a hidden flag.
- Adds a TargetPlatform workaround to lib/main.dart in the standard app template when enabled.
- Supports `app` and `plugin`; `module` support doesn't yet exist for macOS in general.

This will eliminate the need to use FDE's examples as templates on macOS. The templates are based on the current state of FDE's examples, with templating support added (and with adoption of the new application delegate in the app, which hadn't been done yet in FDE, eliminating some boilerplate from the template).

Fixes #30703 
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index b79efb6..2e5ad13 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -146,6 +146,14 @@
     );
     // Deprecated
     argParser.addFlag(
+      'macos',
+      negatable: true,
+      defaultsTo: false,
+      hide: true,
+      help: 'Include support for building a macOS application',
+    );
+    // Deprecated
+    argParser.addFlag(
       'web',
       negatable: true,
       defaultsTo: false,
@@ -385,6 +393,7 @@
       androidLanguage: argResults['android-language'],
       iosLanguage: argResults['ios-language'],
       web: featureFlags.isWebEnabled,
+      macos: argResults['macos'],
     );
 
     final String relativeDirPath = fs.path.relative(projectDirPath);
@@ -595,6 +604,7 @@
     bool renderDriverTest = false,
     bool withPluginHook = false,
     bool web = false,
+    bool macos = false,
   }) {
     flutterRoot = fs.path.normalize(flutterRoot);
 
@@ -602,12 +612,14 @@
     final String pluginClass = pluginDartClass.endsWith('Plugin')
         ? pluginDartClass
         : pluginDartClass + 'Plugin';
+    final String appleIdentifier = _createUTIIdentifier(organization, projectName);
 
     return <String, dynamic>{
       'organization': organization,
       'projectName': projectName,
       'androidIdentifier': _createAndroidIdentifier(organization, projectName),
-      'iosIdentifier': _createUTIIdentifier(organization, projectName),
+      'iosIdentifier': appleIdentifier,
+      'macosIdentifier': appleIdentifier,
       'description': projectDescription,
       'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
       'androidX': androidX,
@@ -623,6 +635,14 @@
       'flutterRevision': FlutterVersion.instance.frameworkRevision,
       'flutterChannel': FlutterVersion.instance.channel,
       'web': web,
+      'macos': macos,
+      'year': DateTime.now().year,
+      // For now, the new plugin schema is only used when a desktop plugin is
+      // enabled. Once the new schema is supported on stable, this should be
+      // removed, and the new schema should always be used.
+      'useNewPluginSchema': macos,
+      // If a desktop platform is included, add a workaround for #31366.
+      'includeTargetPlatformWorkaround': macos,
     };
   }