diff --git a/packages/path_provider/path_provider_foundation/CHANGELOG.md b/packages/path_provider/path_provider_foundation/CHANGELOG.md index 60cf4879e41..7849e7e07c4 100644 --- a/packages/path_provider/path_provider_foundation/CHANGELOG.md +++ b/packages/path_provider/path_provider_foundation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.2.1 + +* Updates to `pigeon` version 9. + ## 2.2.0 * Adds support for `getContainerPath` on iOS. diff --git a/packages/path_provider/path_provider_foundation/darwin/Classes/messages.g.swift b/packages/path_provider/path_provider_foundation/darwin/Classes/messages.g.swift index 095a7308208..7edb31be3b7 100644 --- a/packages/path_provider/path_provider_foundation/darwin/Classes/messages.g.swift +++ b/packages/path_provider/path_provider_foundation/darwin/Classes/messages.g.swift @@ -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 (v5.0.1), do not edit directly. +// Autogenerated from Pigeon (v9.1.1), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -14,7 +14,25 @@ import FlutterMacOS #endif -/// Generated class from Pigeon. + +private func wrapResult(_ result: Any?) -> [Any?] { + return [result] +} + +private func wrapError(_ error: Any) -> [Any?] { + if let flutterError = error as? FlutterError { + return [ + flutterError.code, + flutterError.message, + flutterError.details + ] + } + return [ + "\(error)", + "\(type(of: error))", + "Stacktrace: \(Thread.callStackSymbols)" + ] +} enum DirectoryType: Int { case applicationDocuments = 0 @@ -25,8 +43,8 @@ enum DirectoryType: Int { } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol PathProviderApi { - func getDirectoryPath(type: DirectoryType) -> String? - func getContainerPath(appGroupIdentifier: String) -> String? + func getDirectoryPath(type: DirectoryType) throws -> String? + func getContainerPath(appGroupIdentifier: String) throws -> String? } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -37,10 +55,14 @@ class PathProviderApiSetup { let getDirectoryPathChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.PathProviderApi.getDirectoryPath", binaryMessenger: binaryMessenger) if let api = api { getDirectoryPathChannel.setMessageHandler { message, reply in - let args = message as! [Any?] + let args = message as! [Any] let typeArg = DirectoryType(rawValue: args[0] as! Int)! - let result = api.getDirectoryPath(type: typeArg) - reply(wrapResult(result)) + do { + let result = try api.getDirectoryPath(type: typeArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } } else { getDirectoryPathChannel.setMessageHandler(nil) @@ -48,25 +70,17 @@ class PathProviderApiSetup { let getContainerPathChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.PathProviderApi.getContainerPath", binaryMessenger: binaryMessenger) if let api = api { getContainerPathChannel.setMessageHandler { message, reply in - let args = message as! [Any?] + let args = message as! [Any] let appGroupIdentifierArg = args[0] as! String - let result = api.getContainerPath(appGroupIdentifier: appGroupIdentifierArg) - reply(wrapResult(result)) + do { + let result = try api.getContainerPath(appGroupIdentifier: appGroupIdentifierArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } } else { getContainerPathChannel.setMessageHandler(nil) } } } - -private func wrapResult(_ result: Any?) -> [Any?] { - return [result] -} - -private func wrapError(_ error: FlutterError) -> [Any?] { - return [ - error.code, - error.message, - error.details - ] -} diff --git a/packages/path_provider/path_provider_foundation/lib/messages.g.dart b/packages/path_provider/path_provider_foundation/lib/messages.g.dart index d5074d39f5d..5132a793262 100644 --- a/packages/path_provider/path_provider_foundation/lib/messages.g.dart +++ b/packages/path_provider/path_provider_foundation/lib/messages.g.dart @@ -1,9 +1,10 @@ // 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 (v5.0.1), do not edit directly. +// Autogenerated from Pigeon (v9.1.1), 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 + import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; diff --git a/packages/path_provider/path_provider_foundation/pubspec.yaml b/packages/path_provider/path_provider_foundation/pubspec.yaml index 907ca9c2e3c..def22afc37b 100644 --- a/packages/path_provider/path_provider_foundation/pubspec.yaml +++ b/packages/path_provider/path_provider_foundation/pubspec.yaml @@ -2,7 +2,7 @@ name: path_provider_foundation description: iOS and macOS implementation of the path_provider plugin repository: https://github.com/flutter/packages/tree/main/packages/path_provider/path_provider_foundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22 -version: 2.2.0 +version: 2.2.1 environment: sdk: ">=2.17.0 <4.0.0" @@ -32,4 +32,4 @@ dev_dependencies: sdk: flutter mockito: 5.3.2 path: ^1.8.0 - pigeon: ^5.0.0 + pigeon: ^9.1.0 diff --git a/packages/path_provider/path_provider_foundation/test/messages_test.g.dart b/packages/path_provider/path_provider_foundation/test/messages_test.g.dart index 90af013b69d..3525bee81e3 100644 --- a/packages/path_provider/path_provider_foundation/test/messages_test.g.dart +++ b/packages/path_provider/path_provider_foundation/test/messages_test.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 (v5.0.1), do not edit directly. +// Autogenerated from Pigeon (v9.1.1), 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