blob: 6ec723c8b70fb4d2d6ff43533241fd40d8a2dabe [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 (v13.0.0), do not edit directly.
// See also:
// 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;
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 {
required this.utis,
required this.allowMultiSelection,
List<String?> utis;
bool allowMultiSelection;
Object encode() {
return <Object?>[
static FileSelectorConfig decode(Object result) {
result as List<Object?>;
return FileSelectorConfig(
utis: (result[0] as List<Object?>?)!.cast<String?>(),
allowMultiSelection: result[1]! as bool,
class _FileSelectorApiCodec extends StandardMessageCodec {
const _FileSelectorApiCodec();
void writeValue(WriteBuffer buffer, Object? value) {
if (value is FileSelectorConfig) {
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
return FileSelectorConfig.decode(readValue(buffer)!);
return super.readValueOfType(type, buffer);
class FileSelectorApi {
/// Constructor for [FileSelectorApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
FileSelectorApi({BinaryMessenger? binaryMessenger})
: _binaryMessenger = binaryMessenger;
final BinaryMessenger? _binaryMessenger;
static const MessageCodec<Object?> codec = _FileSelectorApiCodec();
Future<List<String?>> openFile(FileSelectorConfig arg_config) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.file_selector_ios.FileSelectorApi.openFile', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_config]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
} else {
return (replyList[0] as List<Object?>?)!.cast<String?>();