blob: 08ab62aafdb7e85a85576db0194118d5c6483f1f [file] [log] [blame]
// 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.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon
import Foundation
#if os(iOS)
import Flutter
#elseif os(macOS)
import FlutterMacOS
#else
#error("Unsupported platform.")
#endif
/// Generated class from Pigeon.
enum DirectoryType: Int {
case applicationDocuments = 0
case applicationSupport = 1
case downloads = 2
case library = 3
case temp = 4
}
/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
protocol PathProviderApi {
func getDirectoryPath(type: DirectoryType) -> String?
}
/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
class PathProviderApiSetup {
/// The codec used by PathProviderApi.
/// Sets up an instance of `PathProviderApi` to handle messages through the `binaryMessenger`.
static func setUp(binaryMessenger: FlutterBinaryMessenger, api: PathProviderApi?) {
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 typeArg = DirectoryType(rawValue: args[0] as! Int)!
let result = api.getDirectoryPath(type: typeArg)
reply(wrapResult(result))
}
} else {
getDirectoryPathChannel.setMessageHandler(nil)
}
}
}
private func wrapResult(_ result: Any?) -> [Any?] {
return [result]
}
private func wrapError(_ error: FlutterError) -> [Any?] {
return [
error.code,
error.message,
error.details
]
}