| // 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 (v1.0.19), 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 |
| // @dart = 2.12 |
| 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 _NonNullHostApiCodec extends StandardMessageCodec { |
| const _NonNullHostApiCodec(); |
| } |
| |
| class NonNullHostApi { |
| /// Constructor for [NonNullHostApi]. 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. |
| NonNullHostApi({BinaryMessenger? binaryMessenger}) |
| : _binaryMessenger = binaryMessenger; |
| |
| final BinaryMessenger? _binaryMessenger; |
| |
| static const MessageCodec<Object?> codec = _NonNullHostApiCodec(); |
| |
| Future<int?> doit() async { |
| final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( |
| 'dev.flutter.pigeon.NonNullHostApi.doit', codec, |
| 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.', |
| ); |
| } 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 (replyMap['result'] as int?); |
| } |
| } |
| } |
| |
| class _NonNullFlutterApiCodec extends StandardMessageCodec { |
| const _NonNullFlutterApiCodec(); |
| } |
| |
| abstract class NonNullFlutterApi { |
| static const MessageCodec<Object?> codec = _NonNullFlutterApiCodec(); |
| |
| int? doit(); |
| static void setup(NonNullFlutterApi? api, |
| {BinaryMessenger? binaryMessenger}) { |
| { |
| final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( |
| 'dev.flutter.pigeon.NonNullFlutterApi.doit', codec, |
| binaryMessenger: binaryMessenger); |
| if (api == null) { |
| channel.setMessageHandler(null); |
| } else { |
| channel.setMessageHandler((Object? message) async { |
| // ignore message |
| final int? output = api.doit(); |
| return output; |
| }); |
| } |
| } |
| } |
| } |