| |
| // Autogenerated from Pigeon (v29.0.1), do not edit directly. |
| // See also: https://pub.dev/packages/pigeon |
| // ignore_for_file: unused_import, unused_shown_name |
| // ignore_for_file: type=lint |
| |
| import 'dart:async'; |
| import 'dart:typed_data' show Float64List, Int32List, Int64List; |
| |
| import 'package:flutter/services.dart'; |
| import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; |
| |
| Object? _extractReplyValueOrThrow( |
| List<Object?>? replyList, |
| String channelName, { |
| required bool isNullValid, |
| }) { |
| if (replyList == null) { |
| throw PlatformException( |
| code: 'channel-error', |
| message: 'Unable to establish connection on channel: "$channelName".', |
| ); |
| } else if (replyList.length > 1) { |
| throw PlatformException( |
| code: replyList[0]! as String, |
| message: replyList[1] as String?, |
| details: replyList[2], |
| ); |
| } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { |
| throw PlatformException( |
| code: 'null-error', |
| message: 'Host platform returned null value for non-null return value.', |
| ); |
| } |
| return replyList.firstOrNull; |
| } |
| |
| |
| |
| class _PigeonCodec extends StandardMessageCodec { |
| const _PigeonCodec(); |
| @override |
| void writeValue(WriteBuffer buffer, Object? value) { |
| if (value is int) { |
| buffer.putUint8(4); |
| buffer.putInt64(value); |
| } else { |
| super.writeValue(buffer, value); |
| } |
| } |
| |
| @override |
| Object? readValueOfType(int type, ReadBuffer buffer) { |
| switch (type) { |
| default: |
| return super.readValueOfType(type, buffer); |
| } |
| } |
| } |
| |
| class {{pluginClass}}Api { |
| /// Constructor for [{{pluginClass}}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. |
| {{pluginClass}}Api({ |
| BinaryMessenger? binaryMessenger, |
| String messageChannelSuffix = '', |
| }) |
| : pigeonVar_binaryMessenger = binaryMessenger, |
| pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; |
| |
| final BinaryMessenger? pigeonVar_binaryMessenger; |
| static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); |
| |
| final String pigeonVar_messageChannelSuffix; |
| |
| |
| /// Returns the system version of the host platform. |
| Future<String> getPlatformVersion() async { |
| final pigeonVar_channelName = 'dev.flutter.pigeon.{{projectName}}.{{pluginClass}}Api.getPlatformVersion$pigeonVar_messageChannelSuffix'; |
| final pigeonVar_channel = BasicMessageChannel<Object?>( |
| pigeonVar_channelName, |
| pigeonChannelCodec, |
| binaryMessenger: pigeonVar_binaryMessenger, |
| ); |
| final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null); |
| final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; |
| |
| final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( |
| pigeonVar_replyList, |
| pigeonVar_channelName, |
| isNullValid: false, |
| ) |
| ; |
| return pigeonVar_replyValue! as String; |
| } |
| } |