| // 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 (v0.2.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 |
| // @dart = 2.12 |
| import 'dart:async'; |
| import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; |
| |
| import 'package:flutter/services.dart'; |
| |
| enum RequestState { |
| pending, |
| success, |
| failure, |
| } |
| |
| class SearchReply { |
| String? result; |
| String? error; |
| RequestState? state; |
| |
| Object encode() { |
| final Map<Object?, Object?> pigeonMap = <Object?, Object?>{}; |
| pigeonMap['result'] = result; |
| pigeonMap['error'] = error; |
| pigeonMap['state'] = state == null ? null : state!.index; |
| return pigeonMap; |
| } |
| |
| static SearchReply decode(Object message) { |
| final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>; |
| return SearchReply() |
| ..result = pigeonMap['result'] as String? |
| ..error = pigeonMap['error'] as String? |
| ..state = pigeonMap['state'] != null |
| ? RequestState.values[pigeonMap['state']! as int] |
| : null; |
| } |
| } |
| |
| class SearchRequest { |
| String? query; |
| int? anInt; |
| bool? aBool; |
| |
| Object encode() { |
| final Map<Object?, Object?> pigeonMap = <Object?, Object?>{}; |
| pigeonMap['query'] = query; |
| pigeonMap['anInt'] = anInt; |
| pigeonMap['aBool'] = aBool; |
| return pigeonMap; |
| } |
| |
| static SearchRequest decode(Object message) { |
| final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>; |
| return SearchRequest() |
| ..query = pigeonMap['query'] as String? |
| ..anInt = pigeonMap['anInt'] as int? |
| ..aBool = pigeonMap['aBool'] as bool?; |
| } |
| } |
| |
| class Nested { |
| SearchRequest? request; |
| |
| Object encode() { |
| final Map<Object?, Object?> pigeonMap = <Object?, Object?>{}; |
| pigeonMap['request'] = request == null ? null : request!.encode(); |
| return pigeonMap; |
| } |
| |
| static Nested decode(Object message) { |
| final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>; |
| return Nested() |
| ..request = pigeonMap['request'] != null |
| ? SearchRequest.decode(pigeonMap['request']!) |
| : null; |
| } |
| } |
| |
| abstract class FlutterSearchApi { |
| SearchReply search(SearchRequest arg); |
| static void setup(FlutterSearchApi? api) { |
| { |
| const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( |
| 'dev.flutter.pigeon.FlutterSearchApi.search', StandardMessageCodec()); |
| if (api == null) { |
| channel.setMessageHandler(null); |
| } else { |
| channel.setMessageHandler((Object? message) async { |
| assert(message != null, |
| 'Argument for dev.flutter.pigeon.FlutterSearchApi.search was null. Expected SearchRequest.'); |
| final SearchRequest input = SearchRequest.decode(message!); |
| final SearchReply output = api.search(input); |
| return output.encode(); |
| }); |
| } |
| } |
| } |
| } |
| |
| class NestedApi { |
| /// Constructor for [NestedApi]. 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. |
| NestedApi({BinaryMessenger? binaryMessenger}) |
| : _binaryMessenger = binaryMessenger; |
| |
| final BinaryMessenger? _binaryMessenger; |
| |
| Future<SearchReply> search(Nested arg) async { |
| final Object encoded = arg.encode(); |
| final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( |
| 'dev.flutter.pigeon.NestedApi.search', const StandardMessageCodec(), |
| binaryMessenger: _binaryMessenger); |
| final Map<Object?, Object?>? replyMap = |
| await channel.send(encoded) as Map<Object?, Object?>?; |
| if (replyMap == null) { |
| throw PlatformException( |
| code: 'channel-error', |
| message: 'Unable to establish connection on channel.', |
| details: null, |
| ); |
| } 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 { |
| return SearchReply.decode(replyMap['result']!); |
| } |
| } |
| } |
| |
| class Api { |
| /// Constructor for [Api]. 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. |
| Api({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; |
| |
| final BinaryMessenger? _binaryMessenger; |
| |
| Future<void> initialize() async { |
| final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( |
| 'dev.flutter.pigeon.Api.initialize', const StandardMessageCodec(), |
| binaryMessenger: _binaryMessenger); |
| final Map<Object?, Object?>? replyMap = |
| await channel.send(null) as Map<Object?, Object?>?; |
| if (replyMap == null) { |
| throw PlatformException( |
| code: 'channel-error', |
| message: 'Unable to establish connection on channel.', |
| details: null, |
| ); |
| } 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 { |
| // noop |
| } |
| } |
| |
| Future<SearchReply> search(SearchRequest arg) async { |
| final Object encoded = arg.encode(); |
| final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( |
| 'dev.flutter.pigeon.Api.search', const StandardMessageCodec(), |
| binaryMessenger: _binaryMessenger); |
| final Map<Object?, Object?>? replyMap = |
| await channel.send(encoded) as Map<Object?, Object?>?; |
| if (replyMap == null) { |
| throw PlatformException( |
| code: 'channel-error', |
| message: 'Unable to establish connection on channel.', |
| details: null, |
| ); |
| } 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 { |
| return SearchReply.decode(replyMap['result']!); |
| } |
| } |
| } |