| // 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 (v3.2.5), 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 Uint8List, Int32List, Int64List, Float64List; |
| |
| import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; |
| import 'package:flutter/services.dart'; |
| |
| class FileSelectorConfig { |
| FileSelectorConfig({ |
| required this.utis, |
| required this.allowMultiSelection, |
| }); |
| |
| List<String?> utis; |
| bool allowMultiSelection; |
| |
| Object encode() { |
| final Map<Object?, Object?> pigeonMap = <Object?, Object?>{}; |
| pigeonMap['utis'] = utis; |
| pigeonMap['allowMultiSelection'] = allowMultiSelection; |
| return pigeonMap; |
| } |
| |
| static FileSelectorConfig decode(Object message) { |
| final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>; |
| return FileSelectorConfig( |
| utis: (pigeonMap['utis'] as List<Object?>?)!.cast<String?>(), |
| allowMultiSelection: pigeonMap['allowMultiSelection']! as bool, |
| ); |
| } |
| } |
| |
| class _FileSelectorApiCodec extends StandardMessageCodec { |
| const _FileSelectorApiCodec(); |
| @override |
| void writeValue(WriteBuffer buffer, Object? value) { |
| if (value is FileSelectorConfig) { |
| buffer.putUint8(128); |
| writeValue(buffer, value.encode()); |
| } else { |
| super.writeValue(buffer, value); |
| } |
| } |
| |
| @override |
| Object? readValueOfType(int type, ReadBuffer buffer) { |
| switch (type) { |
| case 128: |
| return FileSelectorConfig.decode(readValue(buffer)!); |
| |
| default: |
| 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.FileSelectorApi.openFile', codec, |
| binaryMessenger: _binaryMessenger); |
| final Map<Object?, Object?>? replyMap = |
| await channel.send(<Object?>[arg_config]) as Map<Object?, Object?>?; |
| if (replyMap == null) { |
| throw PlatformException( |
| code: 'channel-error', |
| message: 'Unable to establish connection on channel.', |
| ); |
| } else if (replyMap['error'] != null) { |
| final Map<Object?, Object?> error = |
| (replyMap['error'] as Map<Object?, Object?>?)!; |
| throw PlatformException( |
| code: (error['code'] as String?)!, |
| message: error['message'] as String?, |
| details: error['details'], |
| ); |
| } else if (replyMap['result'] == null) { |
| throw PlatformException( |
| code: 'null-error', |
| message: 'Host platform returned null value for non-null return value.', |
| ); |
| } else { |
| return (replyMap['result'] as List<Object?>?)!.cast<String?>(); |
| } |
| } |
| } |