[file_selector] Updates iOS to Pigeon 13 (#5268)

Picks up several breaking changes, including the switch to unwrapped BOOL properties.
diff --git a/packages/file_selector/file_selector_ios/CHANGELOG.md b/packages/file_selector/file_selector_ios/CHANGELOG.md
index f09aba9..d66052a 100644
--- a/packages/file_selector/file_selector_ios/CHANGELOG.md
+++ b/packages/file_selector/file_selector_ios/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.5.1+7
+
+* Updates to Pigeon 13.
+
 ## 0.5.1+6
 
 * Adds pub topics to package metadata.
diff --git a/packages/file_selector/file_selector_ios/example/ios/RunnerTests/FileSelectorTests.m b/packages/file_selector/file_selector_ios/example/ios/RunnerTests/FileSelectorTests.m
index c52aad5..521beb7 100644
--- a/packages/file_selector/file_selector_ios/example/ios/RunnerTests/FileSelectorTests.m
+++ b/packages/file_selector/file_selector_ios/example/ios/RunnerTests/FileSelectorTests.m
@@ -23,8 +23,7 @@
   plugin.documentPickerViewControllerOverride = picker;
   plugin.presentingViewControllerOverride = mockPresentingVC;
 
-  [plugin openFileSelectorWithConfig:[FFSFileSelectorConfig makeWithUtis:@[]
-                                                     allowMultiSelection:@NO]
+  [plugin openFileSelectorWithConfig:[FFSFileSelectorConfig makeWithUtis:@[] allowMultiSelection:NO]
                           completion:^(NSArray<NSString *> *paths, FlutterError *error){
                           }];
 
@@ -42,7 +41,7 @@
                                                              inMode:UIDocumentPickerModeImport];
   plugin.documentPickerViewControllerOverride = picker;
   [plugin openFileSelectorWithConfig:[FFSFileSelectorConfig makeWithUtis:@[]
-                                                     allowMultiSelection:@YES]
+                                                     allowMultiSelection:YES]
                           completion:^(NSArray<NSString *> *paths, FlutterError *error) {
                             NSArray *expectedPaths = @[ @"/file1.txt", @"/file2.txt" ];
                             XCTAssertEqualObjects(paths, expectedPaths);
@@ -63,8 +62,7 @@
   plugin.documentPickerViewControllerOverride = picker;
 
   XCTestExpectation *completionWasCalled = [self expectationWithDescription:@"completion"];
-  [plugin openFileSelectorWithConfig:[FFSFileSelectorConfig makeWithUtis:@[]
-                                                     allowMultiSelection:@NO]
+  [plugin openFileSelectorWithConfig:[FFSFileSelectorConfig makeWithUtis:@[] allowMultiSelection:NO]
                           completion:^(NSArray<NSString *> *paths, FlutterError *error) {
                             XCTAssertEqual(paths.count, 0);
                             [completionWasCalled fulfill];
diff --git a/packages/file_selector/file_selector_ios/ios/Classes/FFSFileSelectorPlugin.m b/packages/file_selector/file_selector_ios/ios/Classes/FFSFileSelectorPlugin.m
index 8a92cc3..ee9b840 100644
--- a/packages/file_selector/file_selector_ios/ios/Classes/FFSFileSelectorPlugin.m
+++ b/packages/file_selector/file_selector_ios/ios/Classes/FFSFileSelectorPlugin.m
@@ -21,7 +21,7 @@
                  initWithDocumentTypes:config.utis
                                 inMode:UIDocumentPickerModeImport];
   documentPicker.delegate = self;
-  documentPicker.allowsMultipleSelection = config.allowMultiSelection.boolValue;
+  documentPicker.allowsMultipleSelection = config.allowMultiSelection;
 
   UIViewController *presentingVC =
       self.presentingViewControllerOverride
@@ -41,7 +41,7 @@
 
 + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
   FFSFileSelectorPlugin *plugin = [[FFSFileSelectorPlugin alloc] init];
-  FFSFileSelectorApiSetup(registrar.messenger, plugin);
+  SetUpFFSFileSelectorApi(registrar.messenger, plugin);
 }
 
 #pragma mark - UIDocumentPickerDelegate
diff --git a/packages/file_selector/file_selector_ios/ios/Classes/messages.g.h b/packages/file_selector/file_selector_ios/ios/Classes/messages.g.h
index bbaca5b..d0f9d97 100644
--- a/packages/file_selector/file_selector_ios/ios/Classes/messages.g.h
+++ b/packages/file_selector/file_selector_ios/ios/Classes/messages.g.h
@@ -1,7 +1,7 @@
 // Copyright 2013 The Flutter Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-// Autogenerated from Pigeon (v9.2.4), do not edit directly.
+// Autogenerated from Pigeon (v13.0.0), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 #import <Foundation/Foundation.h>
@@ -19,9 +19,9 @@
 /// `init` unavailable to enforce nonnull fields, see the `make` class method.
 - (instancetype)init NS_UNAVAILABLE;
 + (instancetype)makeWithUtis:(NSArray<NSString *> *)utis
-         allowMultiSelection:(NSNumber *)allowMultiSelection;
-@property(nonatomic, strong) NSArray<NSString *> *utis;
-@property(nonatomic, strong) NSNumber *allowMultiSelection;
+         allowMultiSelection:(BOOL)allowMultiSelection;
+@property(nonatomic, copy) NSArray<NSString *> *utis;
+@property(nonatomic, assign) BOOL allowMultiSelection;
 @end
 
 /// The codec used by FFSFileSelectorApi.
@@ -33,7 +33,7 @@
                                              FlutterError *_Nullable))completion;
 @end
 
-extern void FFSFileSelectorApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
+extern void SetUpFFSFileSelectorApi(id<FlutterBinaryMessenger> binaryMessenger,
                                     NSObject<FFSFileSelectorApi> *_Nullable api);
 
 NS_ASSUME_NONNULL_END
diff --git a/packages/file_selector/file_selector_ios/ios/Classes/messages.g.m b/packages/file_selector/file_selector_ios/ios/Classes/messages.g.m
index 8a4ee26..1905261 100644
--- a/packages/file_selector/file_selector_ios/ios/Classes/messages.g.m
+++ b/packages/file_selector/file_selector_ios/ios/Classes/messages.g.m
@@ -1,11 +1,16 @@
 // Copyright 2013 The Flutter Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-// Autogenerated from Pigeon (v9.2.4), do not edit directly.
+// Autogenerated from Pigeon (v13.0.0), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 
 #import "messages.g.h"
+
+#if TARGET_OS_OSX
+#import <FlutterMacOS/FlutterMacOS.h>
+#else
 #import <Flutter/Flutter.h>
+#endif
 
 #if !__has_feature(objc_arc)
 #error File requires ARC to be enabled.
@@ -32,7 +37,7 @@
 
 @implementation FFSFileSelectorConfig
 + (instancetype)makeWithUtis:(NSArray<NSString *> *)utis
-         allowMultiSelection:(NSNumber *)allowMultiSelection {
+         allowMultiSelection:(BOOL)allowMultiSelection {
   FFSFileSelectorConfig *pigeonResult = [[FFSFileSelectorConfig alloc] init];
   pigeonResult.utis = utis;
   pigeonResult.allowMultiSelection = allowMultiSelection;
@@ -41,9 +46,7 @@
 + (FFSFileSelectorConfig *)fromList:(NSArray *)list {
   FFSFileSelectorConfig *pigeonResult = [[FFSFileSelectorConfig alloc] init];
   pigeonResult.utis = GetNullableObjectAtIndex(list, 0);
-  NSAssert(pigeonResult.utis != nil, @"");
-  pigeonResult.allowMultiSelection = GetNullableObjectAtIndex(list, 1);
-  NSAssert(pigeonResult.allowMultiSelection != nil, @"");
+  pigeonResult.allowMultiSelection = [GetNullableObjectAtIndex(list, 1) boolValue];
   return pigeonResult;
 }
 + (nullable FFSFileSelectorConfig *)nullableFromList:(NSArray *)list {
@@ -51,8 +54,8 @@
 }
 - (NSArray *)toList {
   return @[
-    (self.utis ?: [NSNull null]),
-    (self.allowMultiSelection ?: [NSNull null]),
+    self.utis ?: [NSNull null],
+    @(self.allowMultiSelection),
   ];
 }
 @end
@@ -105,11 +108,11 @@
   return sSharedObject;
 }
 
-void FFSFileSelectorApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
+void SetUpFFSFileSelectorApi(id<FlutterBinaryMessenger> binaryMessenger,
                              NSObject<FFSFileSelectorApi> *api) {
   {
     FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
-           initWithName:@"dev.flutter.pigeon.FileSelectorApi.openFile"
+           initWithName:@"dev.flutter.pigeon.file_selector_ios.FileSelectorApi.openFile"
         binaryMessenger:binaryMessenger
                   codec:FFSFileSelectorApiGetCodec()];
     if (api) {
diff --git a/packages/file_selector/file_selector_ios/lib/src/messages.g.dart b/packages/file_selector/file_selector_ios/lib/src/messages.g.dart
index c623de7..6ec723c 100644
--- a/packages/file_selector/file_selector_ios/lib/src/messages.g.dart
+++ b/packages/file_selector/file_selector_ios/lib/src/messages.g.dart
@@ -1,7 +1,7 @@
 // Copyright 2013 The Flutter Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-// Autogenerated from Pigeon (v9.2.4), do not edit directly.
+// Autogenerated from Pigeon (v13.0.0), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
 
@@ -11,6 +11,17 @@
 import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
 import 'package:flutter/services.dart';
 
+List<Object?> wrapResponse(
+    {Object? result, PlatformException? error, bool empty = false}) {
+  if (empty) {
+    return <Object?>[];
+  }
+  if (error == null) {
+    return <Object?>[result];
+  }
+  return <Object?>[error.code, error.message, error.details];
+}
+
 class FileSelectorConfig {
   FileSelectorConfig({
     required this.utis,
@@ -72,7 +83,7 @@
 
   Future<List<String?>> openFile(FileSelectorConfig arg_config) async {
     final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
-        'dev.flutter.pigeon.FileSelectorApi.openFile', codec,
+        'dev.flutter.pigeon.file_selector_ios.FileSelectorApi.openFile', codec,
         binaryMessenger: _binaryMessenger);
     final List<Object?>? replyList =
         await channel.send(<Object?>[arg_config]) as List<Object?>?;
diff --git a/packages/file_selector/file_selector_ios/pubspec.yaml b/packages/file_selector/file_selector_ios/pubspec.yaml
index af8591c..58c0def 100644
--- a/packages/file_selector/file_selector_ios/pubspec.yaml
+++ b/packages/file_selector/file_selector_ios/pubspec.yaml
@@ -2,7 +2,7 @@
 description: iOS implementation of the file_selector plugin.
 repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
-version: 0.5.1+6
+version: 0.5.1+7
 
 environment:
   sdk: ">=2.19.0 <4.0.0"
@@ -26,7 +26,7 @@
   flutter_test:
     sdk: flutter
   mockito: 5.4.1
-  pigeon: ^9.2.4
+  pigeon: ^13.0.0
 
 topics:
   - files
diff --git a/packages/file_selector/file_selector_ios/test/test_api.g.dart b/packages/file_selector/file_selector_ios/test/test_api.g.dart
index 5648f26..7b0ace7 100644
--- a/packages/file_selector/file_selector_ios/test/test_api.g.dart
+++ b/packages/file_selector/file_selector_ios/test/test_api.g.dart
@@ -1,7 +1,7 @@
 // Copyright 2013 The Flutter Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-// Autogenerated from Pigeon (v9.2.4), do not edit directly.
+// Autogenerated from Pigeon (v13.0.0), do not edit directly.
 // See also: https://pub.dev/packages/pigeon
 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import
 // ignore_for_file: avoid_relative_lib_imports
@@ -47,7 +47,8 @@
       {BinaryMessenger? binaryMessenger}) {
     {
       final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
-          'dev.flutter.pigeon.FileSelectorApi.openFile', codec,
+          'dev.flutter.pigeon.file_selector_ios.FileSelectorApi.openFile',
+          codec,
           binaryMessenger: binaryMessenger);
       if (api == null) {
         _testBinaryMessengerBinding!.defaultBinaryMessenger
@@ -57,14 +58,21 @@
             .setMockDecodedMessageHandler<Object?>(channel,
                 (Object? message) async {
           assert(message != null,
-              'Argument for dev.flutter.pigeon.FileSelectorApi.openFile was null.');
+              'Argument for dev.flutter.pigeon.file_selector_ios.FileSelectorApi.openFile was null.');
           final List<Object?> args = (message as List<Object?>?)!;
           final FileSelectorConfig? arg_config =
               (args[0] as FileSelectorConfig?);
           assert(arg_config != null,
-              'Argument for dev.flutter.pigeon.FileSelectorApi.openFile was null, expected non-null FileSelectorConfig.');
-          final List<String?> output = await api.openFile(arg_config!);
-          return <Object?>[output];
+              'Argument for dev.flutter.pigeon.file_selector_ios.FileSelectorApi.openFile was null, expected non-null FileSelectorConfig.');
+          try {
+            final List<String?> output = await api.openFile(arg_config!);
+            return <Object?>[output];
+          } on PlatformException catch (e) {
+            return wrapResponse(error: e);
+          } catch (e) {
+            return wrapResponse(
+                error: PlatformException(code: 'error', message: e.toString()));
+          }
         });
       }
     }