Repository: flutter
Issue: [pigeon] argument is neither an Objective-C object nor a block type
Labels: package,team-ecosystem,has reproducible steps,p: pigeon,P2,found in release: 2.5,found in release: 2.6,triaged-ecosystem

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Define an enum `YourEnum`
2. Define a class `YourObject` with a `Map<YourEnum?,String?>` field
3. Define a pigeon API with a method that takes `YourObject` as input
4. Run pigeon to generate the code
5. Run `flutter build ios`
6. Error: Xcode can't build because of the enum as key of Map

You can also check [this repository](https://github.com/gianlucaparadise/flutter_pigeon_argumenterrot_example) with a sample app:

1. Clone the repo
2. Run `flutter build ios`

**Expected results:**  I expected to use a Map with enum as key

**Actual results:** The Map generates a build error in Xcode

<details>
<summary>Code sample</summary>

<!--
      Please create a minimal reproducible sample that shows the problem
      and attach it below between the lines with the backticks.

      To create it you can use `flutter create bug` command and update the `main.dart` file.

      Alternatively, you can use https://dartpad.dev/
      which is capable of creating and running small Flutter apps.

      Without this we will unlikely be able to progress on the issue, and because of that
      we regretfully will have to close it.
-->

Pigeon API definition:

```dart
enum MessageKey {
  title,
  subtitle,
  description,
}

class Message {
  int? id;
  Map<MessageKey?, String?>? additionalProperties;
}

@HostApi()
abstract class HostApiBridge {
  void sendMessage(Message message);
}
```

A working sample is available in [this repository](https://github.com/gianlucaparadise/flutter_pigeon_argumenterrot_example).

</details>

<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.
-->

```log
Xcode's output:
↳
    In file included from
    /Users/your.name/mydev/pigeon_issue_example/ios/Runner/HostApi.m:3:
    /Users/your.name/mydev/pigeon_issue_example/ios/Runner/HostApi.h:21:53: error: type
    argument 'MessageKey *' (aka 'enum MessageKey *') is neither an Objective-C object nor a block type
    @property(nonatomic, strong, nullable) NSDictionary<MessageKey *, NSString *> * additionalProperties;
                                                        ^~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

Flutter Analyze:

```
Analyzing pigeon_issue_example...                                       
No issues found! (ran in 2.6s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->
Flutter Doctor:

```
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6.1 20G224 darwin-x64, locale en-GB)
    • Flutter version 2.5.2 at /Users/gianluca.paradiso/flutter-sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3595343e20 (6 weeks ago), 2021-09-30 12:58:18 -0700
    • Engine revision 6ac856380f
    • Dart version 2.14.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/gianluca.paradiso/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/gianluca.paradiso/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (2 available)
    • Nexus 5X (mobile) • 02628c9c66bfd34f • android-arm64  • Android 8.1.0 (API 27)
    • Chrome (web)      • chrome           • web-javascript • Google Chrome 95.0.4638.69

• No issues found!
```

</details>