Repository: flutter
Issue: [proposal] Provide way to generate platform files  in flutter module with custom minimum sdk 
Labels: c: new feature,platform-android,platform-ios,tool,a: existing-apps,c: proposal,P2,customer: castaway,team-tool,triaged-tool

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- You must include full steps to reproduce so that we can reproduce the problem. -->

We are trying to embed a feature developed in flutter into an existing iOS app as described in ["option B" of docs for integration](https://flutter.dev/docs/development/add-to-app/ios/project-setup#option-b---embed-frameworks-in-xcode).

For building frameworks, we run:

`flutter build ios-framework --xcframework --no-universal --output=./build`

Dependencies declared in `pubspec.yaml`:

```cupertino_icons: ^1.0.0
  google_maps_flutter: ^1.2.0
  geolocator: ^6.2.0
  shimmer: ^1.1.2
  flutter_riverpod: ^0.12.4
  dio: ^3.0.10
  intl: ^0.16.1
  package_info: ^0.4.3+4
  firebase_core: ^0.7.0
  firebase_crashlytics: ^0.4.0+1
```

**Expected results:** 
The corresponding `.xcframeworks` for each dependency and an `App.xcframework` should be generated.

**Actual results:** <!-- what did you see? -->
The build fails with the following error:
```
Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
    [!] CocoaPods could not find compatible versions for pod "FlutterPluginRegistrant":
      In Podfile:
        FlutterPluginRegistrant (from `Flutter/FlutterPluginRegistrant`)

    Specs satisfying the `FlutterPluginRegistrant (from `Flutter/FlutterPluginRegistrant`)` dependency were found, but they required a higher
    minimum deployment target.
```

We did some analysis, and observed the following:
1. We use the `firebase_crashlytics` dependency on version "0.4.0+1". According to their [changelogs](https://pub.dev/packages/firebase_crashlytics/changelog#030), the minimum supported version was bumped to iOS 10 in version "0.3.0".
2. Our iOS host app (which we use for testing the feature), supports iOS 11+. Hence `pod install` succeeds and we can run it.
3.  When `flutter build ios-framework` is run, flutter ignores the host app, and creates a `.ios` folder within flutter module, as described in [project setup](https://flutter.dev/docs/development/add-to-app/ios/project-setup) ("Add custom iOS code to your own existing application’s project or to a plugin, not to the module’s .ios/ directory. Changes made in your module’s .ios/ directory do not appear in your existing iOS project using the module, and may be overwritten by Flutter.")
4. This generated `.ios` directory has its own Podfile, and a `FlutterPluginRegistrant.podspec` where the supported version number is set to `iOS 9.0`, which is hardcoded over here in [plugins.dart](https://github.com/flutter/flutter/blob/1.22.6/packages/flutter_tools/lib/src/plugins.dart#L896).
5. Hence `pod install` fails with the above error ("requires higher minimum deployment target").

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```

```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->
```
Analyzing flutter_module...
No issues found! (ran in 2.4s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.3 20D91 darwin-x64, locale en-GB)
    • Flutter version 1.22.6 at /Users/ravi/Library/Flutter/flutter
    • Framework revision 9b2d32b605 (9 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/ravi/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[!] Connected device
    ! Error: Ravi’s iPad is not connected. Xcode will continue when Ravi’s iPad is connected. (code -13)

! Doctor found issues in 2 categories.
```

</details>