| // 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 (v9.0.1), do not edit directly. |
| // See also: https://pub.dev/packages/pigeon |
| |
| #undef _HAS_EXCEPTIONS |
| |
| #include "core_tests.gen.h" |
| |
| #include <flutter/basic_message_channel.h> |
| #include <flutter/binary_messenger.h> |
| #include <flutter/encodable_value.h> |
| #include <flutter/standard_message_codec.h> |
| |
| #include <map> |
| #include <optional> |
| #include <string> |
| |
| namespace core_tests_pigeontest { |
| using flutter::BasicMessageChannel; |
| using flutter::CustomEncodableValue; |
| using flutter::EncodableList; |
| using flutter::EncodableMap; |
| using flutter::EncodableValue; |
| |
| // AllTypes |
| |
| bool AllTypes::a_bool() const { return a_bool_; } |
| void AllTypes::set_a_bool(bool value_arg) { a_bool_ = value_arg; } |
| |
| int64_t AllTypes::an_int() const { return an_int_; } |
| void AllTypes::set_an_int(int64_t value_arg) { an_int_ = value_arg; } |
| |
| double AllTypes::a_double() const { return a_double_; } |
| void AllTypes::set_a_double(double value_arg) { a_double_ = value_arg; } |
| |
| const std::vector<uint8_t>& AllTypes::a_byte_array() const { |
| return a_byte_array_; |
| } |
| void AllTypes::set_a_byte_array(const std::vector<uint8_t>& value_arg) { |
| a_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int32_t>& AllTypes::a4_byte_array() const { |
| return a4_byte_array_; |
| } |
| void AllTypes::set_a4_byte_array(const std::vector<int32_t>& value_arg) { |
| a4_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int64_t>& AllTypes::a8_byte_array() const { |
| return a8_byte_array_; |
| } |
| void AllTypes::set_a8_byte_array(const std::vector<int64_t>& value_arg) { |
| a8_byte_array_ = value_arg; |
| } |
| |
| const std::vector<double>& AllTypes::a_float_array() const { |
| return a_float_array_; |
| } |
| void AllTypes::set_a_float_array(const std::vector<double>& value_arg) { |
| a_float_array_ = value_arg; |
| } |
| |
| const EncodableList& AllTypes::a_list() const { return a_list_; } |
| void AllTypes::set_a_list(const EncodableList& value_arg) { |
| a_list_ = value_arg; |
| } |
| |
| const EncodableMap& AllTypes::a_map() const { return a_map_; } |
| void AllTypes::set_a_map(const EncodableMap& value_arg) { a_map_ = value_arg; } |
| |
| const AnEnum& AllTypes::an_enum() const { return an_enum_; } |
| void AllTypes::set_an_enum(const AnEnum& value_arg) { an_enum_ = value_arg; } |
| |
| const std::string& AllTypes::a_string() const { return a_string_; } |
| void AllTypes::set_a_string(std::string_view value_arg) { |
| a_string_ = value_arg; |
| } |
| |
| EncodableList AllTypes::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(11); |
| list.push_back(EncodableValue(a_bool_)); |
| list.push_back(EncodableValue(an_int_)); |
| list.push_back(EncodableValue(a_double_)); |
| list.push_back(EncodableValue(a_byte_array_)); |
| list.push_back(EncodableValue(a4_byte_array_)); |
| list.push_back(EncodableValue(a8_byte_array_)); |
| list.push_back(EncodableValue(a_float_array_)); |
| list.push_back(EncodableValue(a_list_)); |
| list.push_back(EncodableValue(a_map_)); |
| list.push_back(EncodableValue((int)an_enum_)); |
| list.push_back(EncodableValue(a_string_)); |
| return list; |
| } |
| |
| AllTypes::AllTypes() {} |
| |
| AllTypes::AllTypes(const EncodableList& list) { |
| auto& encodable_a_bool = list[0]; |
| if (const bool* pointer_a_bool = std::get_if<bool>(&encodable_a_bool)) { |
| a_bool_ = *pointer_a_bool; |
| } |
| auto& encodable_an_int = list[1]; |
| if (const int32_t* pointer_an_int = std::get_if<int32_t>(&encodable_an_int)) |
| an_int_ = *pointer_an_int; |
| else if (const int64_t* pointer_an_int_64 = |
| std::get_if<int64_t>(&encodable_an_int)) |
| an_int_ = *pointer_an_int_64; |
| auto& encodable_a_double = list[2]; |
| if (const double* pointer_a_double = |
| std::get_if<double>(&encodable_a_double)) { |
| a_double_ = *pointer_a_double; |
| } |
| auto& encodable_a_byte_array = list[3]; |
| if (const std::vector<uint8_t>* pointer_a_byte_array = |
| std::get_if<std::vector<uint8_t>>(&encodable_a_byte_array)) { |
| a_byte_array_ = *pointer_a_byte_array; |
| } |
| auto& encodable_a4_byte_array = list[4]; |
| if (const std::vector<int32_t>* pointer_a4_byte_array = |
| std::get_if<std::vector<int32_t>>(&encodable_a4_byte_array)) { |
| a4_byte_array_ = *pointer_a4_byte_array; |
| } |
| auto& encodable_a8_byte_array = list[5]; |
| if (const std::vector<int64_t>* pointer_a8_byte_array = |
| std::get_if<std::vector<int64_t>>(&encodable_a8_byte_array)) { |
| a8_byte_array_ = *pointer_a8_byte_array; |
| } |
| auto& encodable_a_float_array = list[6]; |
| if (const std::vector<double>* pointer_a_float_array = |
| std::get_if<std::vector<double>>(&encodable_a_float_array)) { |
| a_float_array_ = *pointer_a_float_array; |
| } |
| auto& encodable_a_list = list[7]; |
| if (const EncodableList* pointer_a_list = |
| std::get_if<EncodableList>(&encodable_a_list)) { |
| a_list_ = *pointer_a_list; |
| } |
| auto& encodable_a_map = list[8]; |
| if (const EncodableMap* pointer_a_map = |
| std::get_if<EncodableMap>(&encodable_a_map)) { |
| a_map_ = *pointer_a_map; |
| } |
| auto& encodable_an_enum = list[9]; |
| if (const int32_t* pointer_an_enum = std::get_if<int32_t>(&encodable_an_enum)) |
| an_enum_ = (AnEnum)*pointer_an_enum; |
| auto& encodable_a_string = list[10]; |
| if (const std::string* pointer_a_string = |
| std::get_if<std::string>(&encodable_a_string)) { |
| a_string_ = *pointer_a_string; |
| } |
| } |
| |
| // AllNullableTypes |
| |
| const bool* AllNullableTypes::a_nullable_bool() const { |
| return a_nullable_bool_ ? &(*a_nullable_bool_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_bool(const bool* value_arg) { |
| a_nullable_bool_ = value_arg ? std::optional<bool>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_bool(bool value_arg) { |
| a_nullable_bool_ = value_arg; |
| } |
| |
| const int64_t* AllNullableTypes::a_nullable_int() const { |
| return a_nullable_int_ ? &(*a_nullable_int_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_int(const int64_t* value_arg) { |
| a_nullable_int_ = |
| value_arg ? std::optional<int64_t>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_int(int64_t value_arg) { |
| a_nullable_int_ = value_arg; |
| } |
| |
| const double* AllNullableTypes::a_nullable_double() const { |
| return a_nullable_double_ ? &(*a_nullable_double_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_double(const double* value_arg) { |
| a_nullable_double_ = |
| value_arg ? std::optional<double>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_double(double value_arg) { |
| a_nullable_double_ = value_arg; |
| } |
| |
| const std::vector<uint8_t>* AllNullableTypes::a_nullable_byte_array() const { |
| return a_nullable_byte_array_ ? &(*a_nullable_byte_array_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_byte_array( |
| const std::vector<uint8_t>* value_arg) { |
| a_nullable_byte_array_ = value_arg |
| ? std::optional<std::vector<uint8_t>>(*value_arg) |
| : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_byte_array( |
| const std::vector<uint8_t>& value_arg) { |
| a_nullable_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int32_t>* AllNullableTypes::a_nullable4_byte_array() const { |
| return a_nullable4_byte_array_ ? &(*a_nullable4_byte_array_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable4_byte_array( |
| const std::vector<int32_t>* value_arg) { |
| a_nullable4_byte_array_ = |
| value_arg ? std::optional<std::vector<int32_t>>(*value_arg) |
| : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable4_byte_array( |
| const std::vector<int32_t>& value_arg) { |
| a_nullable4_byte_array_ = value_arg; |
| } |
| |
| const std::vector<int64_t>* AllNullableTypes::a_nullable8_byte_array() const { |
| return a_nullable8_byte_array_ ? &(*a_nullable8_byte_array_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable8_byte_array( |
| const std::vector<int64_t>* value_arg) { |
| a_nullable8_byte_array_ = |
| value_arg ? std::optional<std::vector<int64_t>>(*value_arg) |
| : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable8_byte_array( |
| const std::vector<int64_t>& value_arg) { |
| a_nullable8_byte_array_ = value_arg; |
| } |
| |
| const std::vector<double>* AllNullableTypes::a_nullable_float_array() const { |
| return a_nullable_float_array_ ? &(*a_nullable_float_array_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_float_array( |
| const std::vector<double>* value_arg) { |
| a_nullable_float_array_ = |
| value_arg ? std::optional<std::vector<double>>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_float_array( |
| const std::vector<double>& value_arg) { |
| a_nullable_float_array_ = value_arg; |
| } |
| |
| const EncodableList* AllNullableTypes::a_nullable_list() const { |
| return a_nullable_list_ ? &(*a_nullable_list_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_list(const EncodableList* value_arg) { |
| a_nullable_list_ = |
| value_arg ? std::optional<EncodableList>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_list(const EncodableList& value_arg) { |
| a_nullable_list_ = value_arg; |
| } |
| |
| const EncodableMap* AllNullableTypes::a_nullable_map() const { |
| return a_nullable_map_ ? &(*a_nullable_map_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_map(const EncodableMap* value_arg) { |
| a_nullable_map_ = |
| value_arg ? std::optional<EncodableMap>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_map(const EncodableMap& value_arg) { |
| a_nullable_map_ = value_arg; |
| } |
| |
| const EncodableList* AllNullableTypes::nullable_nested_list() const { |
| return nullable_nested_list_ ? &(*nullable_nested_list_) : nullptr; |
| } |
| void AllNullableTypes::set_nullable_nested_list( |
| const EncodableList* value_arg) { |
| nullable_nested_list_ = |
| value_arg ? std::optional<EncodableList>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_nullable_nested_list( |
| const EncodableList& value_arg) { |
| nullable_nested_list_ = value_arg; |
| } |
| |
| const EncodableMap* AllNullableTypes::nullable_map_with_annotations() const { |
| return nullable_map_with_annotations_ ? &(*nullable_map_with_annotations_) |
| : nullptr; |
| } |
| void AllNullableTypes::set_nullable_map_with_annotations( |
| const EncodableMap* value_arg) { |
| nullable_map_with_annotations_ = |
| value_arg ? std::optional<EncodableMap>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_nullable_map_with_annotations( |
| const EncodableMap& value_arg) { |
| nullable_map_with_annotations_ = value_arg; |
| } |
| |
| const EncodableMap* AllNullableTypes::nullable_map_with_object() const { |
| return nullable_map_with_object_ ? &(*nullable_map_with_object_) : nullptr; |
| } |
| void AllNullableTypes::set_nullable_map_with_object( |
| const EncodableMap* value_arg) { |
| nullable_map_with_object_ = |
| value_arg ? std::optional<EncodableMap>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_nullable_map_with_object( |
| const EncodableMap& value_arg) { |
| nullable_map_with_object_ = value_arg; |
| } |
| |
| const AnEnum* AllNullableTypes::a_nullable_enum() const { |
| return a_nullable_enum_ ? &(*a_nullable_enum_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_enum(const AnEnum* value_arg) { |
| a_nullable_enum_ = |
| value_arg ? std::optional<AnEnum>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_enum(const AnEnum& value_arg) { |
| a_nullable_enum_ = value_arg; |
| } |
| |
| const std::string* AllNullableTypes::a_nullable_string() const { |
| return a_nullable_string_ ? &(*a_nullable_string_) : nullptr; |
| } |
| void AllNullableTypes::set_a_nullable_string( |
| const std::string_view* value_arg) { |
| a_nullable_string_ = |
| value_arg ? std::optional<std::string>(*value_arg) : std::nullopt; |
| } |
| void AllNullableTypes::set_a_nullable_string(std::string_view value_arg) { |
| a_nullable_string_ = value_arg; |
| } |
| |
| EncodableList AllNullableTypes::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(14); |
| list.push_back(a_nullable_bool_ ? EncodableValue(*a_nullable_bool_) |
| : EncodableValue()); |
| list.push_back(a_nullable_int_ ? EncodableValue(*a_nullable_int_) |
| : EncodableValue()); |
| list.push_back(a_nullable_double_ ? EncodableValue(*a_nullable_double_) |
| : EncodableValue()); |
| list.push_back(a_nullable_byte_array_ |
| ? EncodableValue(*a_nullable_byte_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable4_byte_array_ |
| ? EncodableValue(*a_nullable4_byte_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable8_byte_array_ |
| ? EncodableValue(*a_nullable8_byte_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable_float_array_ |
| ? EncodableValue(*a_nullable_float_array_) |
| : EncodableValue()); |
| list.push_back(a_nullable_list_ ? EncodableValue(*a_nullable_list_) |
| : EncodableValue()); |
| list.push_back(a_nullable_map_ ? EncodableValue(*a_nullable_map_) |
| : EncodableValue()); |
| list.push_back(nullable_nested_list_ ? EncodableValue(*nullable_nested_list_) |
| : EncodableValue()); |
| list.push_back(nullable_map_with_annotations_ |
| ? EncodableValue(*nullable_map_with_annotations_) |
| : EncodableValue()); |
| list.push_back(nullable_map_with_object_ |
| ? EncodableValue(*nullable_map_with_object_) |
| : EncodableValue()); |
| list.push_back(a_nullable_enum_ ? EncodableValue((int)(*a_nullable_enum_)) |
| : EncodableValue()); |
| list.push_back(a_nullable_string_ ? EncodableValue(*a_nullable_string_) |
| : EncodableValue()); |
| return list; |
| } |
| |
| AllNullableTypes::AllNullableTypes() {} |
| |
| AllNullableTypes::AllNullableTypes(const EncodableList& list) { |
| auto& encodable_a_nullable_bool = list[0]; |
| if (const bool* pointer_a_nullable_bool = |
| std::get_if<bool>(&encodable_a_nullable_bool)) { |
| a_nullable_bool_ = *pointer_a_nullable_bool; |
| } |
| auto& encodable_a_nullable_int = list[1]; |
| if (const int32_t* pointer_a_nullable_int = |
| std::get_if<int32_t>(&encodable_a_nullable_int)) |
| a_nullable_int_ = *pointer_a_nullable_int; |
| else if (const int64_t* pointer_a_nullable_int_64 = |
| std::get_if<int64_t>(&encodable_a_nullable_int)) |
| a_nullable_int_ = *pointer_a_nullable_int_64; |
| auto& encodable_a_nullable_double = list[2]; |
| if (const double* pointer_a_nullable_double = |
| std::get_if<double>(&encodable_a_nullable_double)) { |
| a_nullable_double_ = *pointer_a_nullable_double; |
| } |
| auto& encodable_a_nullable_byte_array = list[3]; |
| if (const std::vector<uint8_t>* pointer_a_nullable_byte_array = |
| std::get_if<std::vector<uint8_t>>(&encodable_a_nullable_byte_array)) { |
| a_nullable_byte_array_ = *pointer_a_nullable_byte_array; |
| } |
| auto& encodable_a_nullable4_byte_array = list[4]; |
| if (const std::vector<int32_t>* pointer_a_nullable4_byte_array = |
| std::get_if<std::vector<int32_t>>( |
| &encodable_a_nullable4_byte_array)) { |
| a_nullable4_byte_array_ = *pointer_a_nullable4_byte_array; |
| } |
| auto& encodable_a_nullable8_byte_array = list[5]; |
| if (const std::vector<int64_t>* pointer_a_nullable8_byte_array = |
| std::get_if<std::vector<int64_t>>( |
| &encodable_a_nullable8_byte_array)) { |
| a_nullable8_byte_array_ = *pointer_a_nullable8_byte_array; |
| } |
| auto& encodable_a_nullable_float_array = list[6]; |
| if (const std::vector<double>* pointer_a_nullable_float_array = |
| std::get_if<std::vector<double>>(&encodable_a_nullable_float_array)) { |
| a_nullable_float_array_ = *pointer_a_nullable_float_array; |
| } |
| auto& encodable_a_nullable_list = list[7]; |
| if (const EncodableList* pointer_a_nullable_list = |
| std::get_if<EncodableList>(&encodable_a_nullable_list)) { |
| a_nullable_list_ = *pointer_a_nullable_list; |
| } |
| auto& encodable_a_nullable_map = list[8]; |
| if (const EncodableMap* pointer_a_nullable_map = |
| std::get_if<EncodableMap>(&encodable_a_nullable_map)) { |
| a_nullable_map_ = *pointer_a_nullable_map; |
| } |
| auto& encodable_nullable_nested_list = list[9]; |
| if (const EncodableList* pointer_nullable_nested_list = |
| std::get_if<EncodableList>(&encodable_nullable_nested_list)) { |
| nullable_nested_list_ = *pointer_nullable_nested_list; |
| } |
| auto& encodable_nullable_map_with_annotations = list[10]; |
| if (const EncodableMap* pointer_nullable_map_with_annotations = |
| std::get_if<EncodableMap>(&encodable_nullable_map_with_annotations)) { |
| nullable_map_with_annotations_ = *pointer_nullable_map_with_annotations; |
| } |
| auto& encodable_nullable_map_with_object = list[11]; |
| if (const EncodableMap* pointer_nullable_map_with_object = |
| std::get_if<EncodableMap>(&encodable_nullable_map_with_object)) { |
| nullable_map_with_object_ = *pointer_nullable_map_with_object; |
| } |
| auto& encodable_a_nullable_enum = list[12]; |
| if (const int32_t* pointer_a_nullable_enum = |
| std::get_if<int32_t>(&encodable_a_nullable_enum)) |
| a_nullable_enum_ = (AnEnum)*pointer_a_nullable_enum; |
| auto& encodable_a_nullable_string = list[13]; |
| if (const std::string* pointer_a_nullable_string = |
| std::get_if<std::string>(&encodable_a_nullable_string)) { |
| a_nullable_string_ = *pointer_a_nullable_string; |
| } |
| } |
| |
| // AllNullableTypesWrapper |
| |
| const AllNullableTypes& AllNullableTypesWrapper::values() const { |
| return values_; |
| } |
| void AllNullableTypesWrapper::set_values(const AllNullableTypes& value_arg) { |
| values_ = value_arg; |
| } |
| |
| EncodableList AllNullableTypesWrapper::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(1); |
| list.push_back(EncodableValue(values_.ToEncodableList())); |
| return list; |
| } |
| |
| AllNullableTypesWrapper::AllNullableTypesWrapper() {} |
| |
| AllNullableTypesWrapper::AllNullableTypesWrapper(const EncodableList& list) { |
| auto& encodable_values = list[0]; |
| if (const EncodableList* pointer_values = |
| std::get_if<EncodableList>(&encodable_values)) { |
| values_ = AllNullableTypes(*pointer_values); |
| } |
| } |
| |
| // TestMessage |
| |
| const EncodableList* TestMessage::test_list() const { |
| return test_list_ ? &(*test_list_) : nullptr; |
| } |
| void TestMessage::set_test_list(const EncodableList* value_arg) { |
| test_list_ = |
| value_arg ? std::optional<EncodableList>(*value_arg) : std::nullopt; |
| } |
| void TestMessage::set_test_list(const EncodableList& value_arg) { |
| test_list_ = value_arg; |
| } |
| |
| EncodableList TestMessage::ToEncodableList() const { |
| EncodableList list; |
| list.reserve(1); |
| list.push_back(test_list_ ? EncodableValue(*test_list_) : EncodableValue()); |
| return list; |
| } |
| |
| TestMessage::TestMessage() {} |
| |
| TestMessage::TestMessage(const EncodableList& list) { |
| auto& encodable_test_list = list[0]; |
| if (const EncodableList* pointer_test_list = |
| std::get_if<EncodableList>(&encodable_test_list)) { |
| test_list_ = *pointer_test_list; |
| } |
| } |
| |
| HostIntegrationCoreApiCodecSerializer::HostIntegrationCoreApiCodecSerializer() { |
| } |
| EncodableValue HostIntegrationCoreApiCodecSerializer::ReadValueOfType( |
| uint8_t type, flutter::ByteStreamReader* stream) const { |
| switch (type) { |
| case 128: |
| return CustomEncodableValue( |
| AllNullableTypes(std::get<EncodableList>(ReadValue(stream)))); |
| case 129: |
| return CustomEncodableValue( |
| AllNullableTypesWrapper(std::get<EncodableList>(ReadValue(stream)))); |
| case 130: |
| return CustomEncodableValue( |
| AllTypes(std::get<EncodableList>(ReadValue(stream)))); |
| case 131: |
| return CustomEncodableValue( |
| TestMessage(std::get<EncodableList>(ReadValue(stream)))); |
| default: |
| return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); |
| } |
| } |
| |
| void HostIntegrationCoreApiCodecSerializer::WriteValue( |
| const EncodableValue& value, flutter::ByteStreamWriter* stream) const { |
| if (const CustomEncodableValue* custom_value = |
| std::get_if<CustomEncodableValue>(&value)) { |
| if (custom_value->type() == typeid(AllNullableTypes)) { |
| stream->WriteByte(128); |
| WriteValue( |
| EncodableValue( |
| std::any_cast<AllNullableTypes>(*custom_value).ToEncodableList()), |
| stream); |
| return; |
| } |
| if (custom_value->type() == typeid(AllNullableTypesWrapper)) { |
| stream->WriteByte(129); |
| WriteValue( |
| EncodableValue(std::any_cast<AllNullableTypesWrapper>(*custom_value) |
| .ToEncodableList()), |
| stream); |
| return; |
| } |
| if (custom_value->type() == typeid(AllTypes)) { |
| stream->WriteByte(130); |
| WriteValue(EncodableValue( |
| std::any_cast<AllTypes>(*custom_value).ToEncodableList()), |
| stream); |
| return; |
| } |
| if (custom_value->type() == typeid(TestMessage)) { |
| stream->WriteByte(131); |
| WriteValue( |
| EncodableValue( |
| std::any_cast<TestMessage>(*custom_value).ToEncodableList()), |
| stream); |
| return; |
| } |
| } |
| flutter::StandardCodecSerializer::WriteValue(value, stream); |
| } |
| |
| /// The codec used by HostIntegrationCoreApi. |
| const flutter::StandardMessageCodec& HostIntegrationCoreApi::GetCodec() { |
| return flutter::StandardMessageCodec::GetInstance( |
| &HostIntegrationCoreApiCodecSerializer::GetInstance()); |
| } |
| |
| // Sets up an instance of `HostIntegrationCoreApi` to handle messages through |
| // the `binary_messenger`. |
| void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, |
| HostIntegrationCoreApi* api) { |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noop", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| std::optional<FlutterError> output = api->Noop(); |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllTypes", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| if (encodable_everything_arg.IsNull()) { |
| reply(WrapError("everything_arg unexpectedly null.")); |
| return; |
| } |
| const auto& everything_arg = std::any_cast<const AllTypes&>( |
| std::get<CustomEncodableValue>(encodable_everything_arg)); |
| ErrorOr<AllTypes> output = api->EchoAllTypes(everything_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.throwError", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| ErrorOr<std::optional<EncodableValue>> output = api->ThrowError(); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.throwErrorFromVoid", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| std::optional<FlutterError> output = api->ThrowErrorFromVoid(); |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_int_arg = args.at(0); |
| if (encodable_an_int_arg.IsNull()) { |
| reply(WrapError("an_int_arg unexpectedly null.")); |
| return; |
| } |
| const int64_t an_int_arg = encodable_an_int_arg.LongValue(); |
| ErrorOr<int64_t> output = api->EchoInt(an_int_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_double_arg = args.at(0); |
| if (encodable_a_double_arg.IsNull()) { |
| reply(WrapError("a_double_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_double_arg = |
| std::get<double>(encodable_a_double_arg); |
| ErrorOr<double> output = api->EchoDouble(a_double_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| if (encodable_a_bool_arg.IsNull()) { |
| reply(WrapError("a_bool_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_bool_arg = std::get<bool>(encodable_a_bool_arg); |
| ErrorOr<bool> output = api->EchoBool(a_bool_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoString", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_string_arg = args.at(0); |
| if (encodable_a_string_arg.IsNull()) { |
| reply(WrapError("a_string_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_string_arg = |
| std::get<std::string>(encodable_a_string_arg); |
| ErrorOr<std::string> output = api->EchoString(a_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_uint8_list_arg = args.at(0); |
| if (encodable_a_uint8_list_arg.IsNull()) { |
| reply(WrapError("a_uint8_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_uint8_list_arg = |
| std::get<std::vector<uint8_t>>(encodable_a_uint8_list_arg); |
| ErrorOr<std::vector<uint8_t>> output = |
| api->EchoUint8List(a_uint8_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoObject", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_object_arg = args.at(0); |
| if (encodable_an_object_arg.IsNull()) { |
| reply(WrapError("an_object_arg unexpectedly null.")); |
| return; |
| } |
| const auto& an_object_arg = encodable_an_object_arg; |
| ErrorOr<EncodableValue> output = api->EchoObject(an_object_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| if (encodable_a_list_arg.IsNull()) { |
| reply(WrapError("a_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_list_arg = |
| std::get<EncodableList>(encodable_a_list_arg); |
| ErrorOr<EncodableList> output = api->EchoList(a_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.echoMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_map_arg = args.at(0); |
| if (encodable_a_map_arg.IsNull()) { |
| reply(WrapError("a_map_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_map_arg = |
| std::get<EncodableMap>(encodable_a_map_arg); |
| ErrorOr<EncodableMap> output = api->EchoMap(a_map_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAllNullableTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| const auto* everything_arg = |
| &(std::any_cast<const AllNullableTypes&>( |
| std::get<CustomEncodableValue>( |
| encodable_everything_arg))); |
| ErrorOr<std::optional<AllNullableTypes>> output = |
| api->EchoAllNullableTypes(everything_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.extractNestedNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_wrapper_arg = args.at(0); |
| if (encodable_wrapper_arg.IsNull()) { |
| reply(WrapError("wrapper_arg unexpectedly null.")); |
| return; |
| } |
| const auto& wrapper_arg = |
| std::any_cast<const AllNullableTypesWrapper&>( |
| std::get<CustomEncodableValue>(encodable_wrapper_arg)); |
| ErrorOr<std::optional<std::string>> output = |
| api->ExtractNestedNullableString(wrapper_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.createNestedNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_nullable_string_arg = args.at(0); |
| const auto* nullable_string_arg = |
| std::get_if<std::string>(&encodable_nullable_string_arg); |
| ErrorOr<AllNullableTypesWrapper> output = |
| api->CreateNestedNullableString(nullable_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.sendMultipleNullableTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_bool_arg = args.at(0); |
| const auto* a_nullable_bool_arg = |
| std::get_if<bool>(&encodable_a_nullable_bool_arg); |
| const auto& encodable_a_nullable_int_arg = args.at(1); |
| const int64_t a_nullable_int_arg_value = |
| encodable_a_nullable_int_arg.IsNull() |
| ? 0 |
| : encodable_a_nullable_int_arg.LongValue(); |
| const auto* a_nullable_int_arg = |
| encodable_a_nullable_int_arg.IsNull() |
| ? nullptr |
| : &a_nullable_int_arg_value; |
| const auto& encodable_a_nullable_string_arg = args.at(2); |
| const auto* a_nullable_string_arg = |
| std::get_if<std::string>(&encodable_a_nullable_string_arg); |
| ErrorOr<AllNullableTypes> output = api->SendMultipleNullableTypes( |
| a_nullable_bool_arg, a_nullable_int_arg, |
| a_nullable_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_int_arg = args.at(0); |
| const int64_t a_nullable_int_arg_value = |
| encodable_a_nullable_int_arg.IsNull() |
| ? 0 |
| : encodable_a_nullable_int_arg.LongValue(); |
| const auto* a_nullable_int_arg = |
| encodable_a_nullable_int_arg.IsNull() |
| ? nullptr |
| : &a_nullable_int_arg_value; |
| ErrorOr<std::optional<int64_t>> output = |
| api->EchoNullableInt(a_nullable_int_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_double_arg = args.at(0); |
| const auto* a_nullable_double_arg = |
| std::get_if<double>(&encodable_a_nullable_double_arg); |
| ErrorOr<std::optional<double>> output = |
| api->EchoNullableDouble(a_nullable_double_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_bool_arg = args.at(0); |
| const auto* a_nullable_bool_arg = |
| std::get_if<bool>(&encodable_a_nullable_bool_arg); |
| ErrorOr<std::optional<bool>> output = |
| api->EchoNullableBool(a_nullable_bool_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_string_arg = args.at(0); |
| const auto* a_nullable_string_arg = |
| std::get_if<std::string>(&encodable_a_nullable_string_arg); |
| ErrorOr<std::optional<std::string>> output = |
| api->EchoNullableString(a_nullable_string_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_uint8_list_arg = args.at(0); |
| const auto* a_nullable_uint8_list_arg = |
| std::get_if<std::vector<uint8_t>>( |
| &encodable_a_nullable_uint8_list_arg); |
| ErrorOr<std::optional<std::vector<uint8_t>>> output = |
| api->EchoNullableUint8List(a_nullable_uint8_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableObject", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_object_arg = args.at(0); |
| const auto* a_nullable_object_arg = |
| &encodable_a_nullable_object_arg; |
| ErrorOr<std::optional<EncodableValue>> output = |
| api->EchoNullableObject(a_nullable_object_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_list_arg = args.at(0); |
| const auto* a_nullable_list_arg = |
| std::get_if<EncodableList>(&encodable_a_nullable_list_arg); |
| ErrorOr<std::optional<EncodableList>> output = |
| api->EchoNullableList(a_nullable_list_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoNullableMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_map_arg = args.at(0); |
| const auto* a_nullable_map_arg = |
| std::get_if<EncodableMap>(&encodable_a_nullable_map_arg); |
| ErrorOr<std::optional<EncodableMap>> output = |
| api->EchoNullableMap(a_nullable_map_arg); |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, "dev.flutter.pigeon.HostIntegrationCoreApi.noopAsync", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->NoopAsync([reply](std::optional<FlutterError>&& output) { |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncInt", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_int_arg = args.at(0); |
| if (encodable_an_int_arg.IsNull()) { |
| reply(WrapError("an_int_arg unexpectedly null.")); |
| return; |
| } |
| const int64_t an_int_arg = encodable_an_int_arg.LongValue(); |
| api->EchoAsyncInt(an_int_arg, [reply](ErrorOr<int64_t>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_double_arg = args.at(0); |
| if (encodable_a_double_arg.IsNull()) { |
| reply(WrapError("a_double_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_double_arg = |
| std::get<double>(encodable_a_double_arg); |
| api->EchoAsyncDouble( |
| a_double_arg, [reply](ErrorOr<double>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncBool", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| if (encodable_a_bool_arg.IsNull()) { |
| reply(WrapError("a_bool_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_bool_arg = std::get<bool>(encodable_a_bool_arg); |
| api->EchoAsyncBool(a_bool_arg, [reply](ErrorOr<bool>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_string_arg = args.at(0); |
| if (encodable_a_string_arg.IsNull()) { |
| reply(WrapError("a_string_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_string_arg = |
| std::get<std::string>(encodable_a_string_arg); |
| api->EchoAsyncString( |
| a_string_arg, [reply](ErrorOr<std::string>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_uint8_list_arg = args.at(0); |
| if (encodable_a_uint8_list_arg.IsNull()) { |
| reply(WrapError("a_uint8_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_uint8_list_arg = |
| std::get<std::vector<uint8_t>>(encodable_a_uint8_list_arg); |
| api->EchoAsyncUint8List( |
| a_uint8_list_arg, |
| [reply](ErrorOr<std::vector<uint8_t>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncObject", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_object_arg = args.at(0); |
| if (encodable_an_object_arg.IsNull()) { |
| reply(WrapError("an_object_arg unexpectedly null.")); |
| return; |
| } |
| const auto& an_object_arg = encodable_an_object_arg; |
| api->EchoAsyncObject( |
| an_object_arg, [reply](ErrorOr<EncodableValue>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncList", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| if (encodable_a_list_arg.IsNull()) { |
| reply(WrapError("a_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_list_arg = |
| std::get<EncodableList>(encodable_a_list_arg); |
| api->EchoAsyncList( |
| a_list_arg, [reply](ErrorOr<EncodableList>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncMap", &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_map_arg = args.at(0); |
| if (encodable_a_map_arg.IsNull()) { |
| reply(WrapError("a_map_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_map_arg = |
| std::get<EncodableMap>(encodable_a_map_arg); |
| api->EchoAsyncMap( |
| a_map_arg, [reply](ErrorOr<EncodableMap>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncError", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->ThrowAsyncError( |
| [reply](ErrorOr<std::optional<EncodableValue>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.throwAsyncErrorFromVoid", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->ThrowAsyncErrorFromVoid( |
| [reply](std::optional<FlutterError>&& output) { |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncAllTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| if (encodable_everything_arg.IsNull()) { |
| reply(WrapError("everything_arg unexpectedly null.")); |
| return; |
| } |
| const auto& everything_arg = std::any_cast<const AllTypes&>( |
| std::get<CustomEncodableValue>(encodable_everything_arg)); |
| api->EchoAsyncAllTypes( |
| everything_arg, [reply](ErrorOr<AllTypes>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi." |
| "echoAsyncNullableAllNullableTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| const auto* everything_arg = |
| &(std::any_cast<const AllNullableTypes&>( |
| std::get<CustomEncodableValue>( |
| encodable_everything_arg))); |
| api->EchoAsyncNullableAllNullableTypes( |
| everything_arg, |
| [reply](ErrorOr<std::optional<AllNullableTypes>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back(CustomEncodableValue( |
| std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_int_arg = args.at(0); |
| const int64_t an_int_arg_value = |
| encodable_an_int_arg.IsNull() |
| ? 0 |
| : encodable_an_int_arg.LongValue(); |
| const auto* an_int_arg = |
| encodable_an_int_arg.IsNull() ? nullptr : &an_int_arg_value; |
| api->EchoAsyncNullableInt( |
| an_int_arg, |
| [reply](ErrorOr<std::optional<int64_t>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_double_arg = args.at(0); |
| const auto* a_double_arg = |
| std::get_if<double>(&encodable_a_double_arg); |
| api->EchoAsyncNullableDouble( |
| a_double_arg, |
| [reply](ErrorOr<std::optional<double>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| const auto* a_bool_arg = std::get_if<bool>(&encodable_a_bool_arg); |
| api->EchoAsyncNullableBool( |
| a_bool_arg, [reply](ErrorOr<std::optional<bool>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_string_arg = args.at(0); |
| const auto* a_string_arg = |
| std::get_if<std::string>(&encodable_a_string_arg); |
| api->EchoAsyncNullableString( |
| a_string_arg, |
| [reply](ErrorOr<std::optional<std::string>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_uint8_list_arg = args.at(0); |
| const auto* a_uint8_list_arg = std::get_if<std::vector<uint8_t>>( |
| &encodable_a_uint8_list_arg); |
| api->EchoAsyncNullableUint8List( |
| a_uint8_list_arg, |
| [reply]( |
| ErrorOr<std::optional<std::vector<uint8_t>>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableObject", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_object_arg = args.at(0); |
| const auto* an_object_arg = &encodable_an_object_arg; |
| api->EchoAsyncNullableObject( |
| an_object_arg, |
| [reply](ErrorOr<std::optional<EncodableValue>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| const auto* a_list_arg = |
| std::get_if<EncodableList>(&encodable_a_list_arg); |
| api->EchoAsyncNullableList( |
| a_list_arg, |
| [reply](ErrorOr<std::optional<EncodableList>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.echoAsyncNullableMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_map_arg = args.at(0); |
| const auto* a_map_arg = |
| std::get_if<EncodableMap>(&encodable_a_map_arg); |
| api->EchoAsyncNullableMap( |
| a_map_arg, |
| [reply](ErrorOr<std::optional<EncodableMap>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterNoop", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->CallFlutterNoop( |
| [reply](std::optional<FlutterError>&& output) { |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterThrowError", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->CallFlutterThrowError( |
| [reply](ErrorOr<std::optional<EncodableValue>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeValue(); |
| if (output_optional) { |
| wrapped.push_back( |
| EncodableValue(std::move(output_optional).value())); |
| } else { |
| wrapped.push_back(EncodableValue()); |
| } |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi." |
| "callFlutterThrowErrorFromVoid", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| api->CallFlutterThrowErrorFromVoid( |
| [reply](std::optional<FlutterError>&& output) { |
| if (output.has_value()) { |
| reply(WrapError(output.value())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back(EncodableValue()); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoAllTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_everything_arg = args.at(0); |
| if (encodable_everything_arg.IsNull()) { |
| reply(WrapError("everything_arg unexpectedly null.")); |
| return; |
| } |
| const auto& everything_arg = std::any_cast<const AllTypes&>( |
| std::get<CustomEncodableValue>(encodable_everything_arg)); |
| api->CallFlutterEchoAllTypes( |
| everything_arg, [reply](ErrorOr<AllTypes>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi." |
| "callFlutterSendMultipleNullableTypes", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_nullable_bool_arg = args.at(0); |
| const auto* a_nullable_bool_arg = |
| std::get_if<bool>(&encodable_a_nullable_bool_arg); |
| const auto& encodable_a_nullable_int_arg = args.at(1); |
| const int64_t a_nullable_int_arg_value = |
| encodable_a_nullable_int_arg.IsNull() |
| ? 0 |
| : encodable_a_nullable_int_arg.LongValue(); |
| const auto* a_nullable_int_arg = |
| encodable_a_nullable_int_arg.IsNull() |
| ? nullptr |
| : &a_nullable_int_arg_value; |
| const auto& encodable_a_nullable_string_arg = args.at(2); |
| const auto* a_nullable_string_arg = |
| std::get_if<std::string>(&encodable_a_nullable_string_arg); |
| api->CallFlutterSendMultipleNullableTypes( |
| a_nullable_bool_arg, a_nullable_int_arg, |
| a_nullable_string_arg, |
| [reply](ErrorOr<AllNullableTypes>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| CustomEncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| if (encodable_a_bool_arg.IsNull()) { |
| reply(WrapError("a_bool_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_bool_arg = std::get<bool>(encodable_a_bool_arg); |
| api->CallFlutterEchoBool( |
| a_bool_arg, [reply](ErrorOr<bool>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoInt", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_an_int_arg = args.at(0); |
| if (encodable_an_int_arg.IsNull()) { |
| reply(WrapError("an_int_arg unexpectedly null.")); |
| return; |
| } |
| const int64_t an_int_arg = encodable_an_int_arg.LongValue(); |
| api->CallFlutterEchoInt( |
| an_int_arg, [reply](ErrorOr<int64_t>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoDouble", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_double_arg = args.at(0); |
| if (encodable_a_double_arg.IsNull()) { |
| reply(WrapError("a_double_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_double_arg = |
| std::get<double>(encodable_a_double_arg); |
| api->CallFlutterEchoDouble( |
| a_double_arg, [reply](ErrorOr<double>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoString", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_string_arg = args.at(0); |
| if (encodable_a_string_arg.IsNull()) { |
| reply(WrapError("a_string_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_string_arg = |
| std::get<std::string>(encodable_a_string_arg); |
| api->CallFlutterEchoString( |
| a_string_arg, [reply](ErrorOr<std::string>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoUint8List", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| if (encodable_a_list_arg.IsNull()) { |
| reply(WrapError("a_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_list_arg = |
| std::get<std::vector<uint8_t>>(encodable_a_list_arg); |
| api->CallFlutterEchoUint8List( |
| a_list_arg, [reply](ErrorOr<std::vector<uint8_t>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoList", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_list_arg = args.at(0); |
| if (encodable_a_list_arg.IsNull()) { |
| reply(WrapError("a_list_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_list_arg = |
| std::get<EncodableList>(encodable_a_list_arg); |
| api->CallFlutterEchoList( |
| a_list_arg, [reply](ErrorOr<EncodableList>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoMap", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_map_arg = args.at(0); |
| if (encodable_a_map_arg.IsNull()) { |
| reply(WrapError("a_map_arg unexpectedly null.")); |
| return; |
| } |
| const auto& a_map_arg = |
| std::get<EncodableMap>(encodable_a_map_arg); |
| api->CallFlutterEchoMap( |
| a_map_arg, [reply](ErrorOr<EncodableMap>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| wrapped.push_back( |
| EncodableValue(std::move(output).TakeValue())); |
| reply(EncodableValue(std::move(wrapped))); |
| }); |
| } catch (const std::exception& exception) { |
| reply(WrapError(exception.what())); |
| } |
| }); |
| } else { |
| channel->SetMessageHandler(nullptr); |
| } |
| } |
| { |
| auto channel = std::make_unique<BasicMessageChannel<>>( |
| binary_messenger, |
| "dev.flutter.pigeon.HostIntegrationCoreApi.callFlutterEchoNullableBool", |
| &GetCodec()); |
| if (api != nullptr) { |
| channel->SetMessageHandler( |
| [api](const EncodableValue& message, |
| const flutter::MessageReply<EncodableValue>& reply) { |
| try { |
| const auto& args = std::get<EncodableList>(message); |
| const auto& encodable_a_bool_arg = args.at(0); |
| const auto* a_bool_arg = std::get_if<bool>(&encodable_a_bool_arg); |
| api->CallFlutterEchoNullableBool( |
| a_bool_arg, [reply](ErrorOr<std::optional<bool>>&& output) { |
| if (output.has_error()) { |
| reply(WrapError(output.error())); |
| return; |
| } |
| EncodableList wrapped; |
| auto output_optional = std::move(output).TakeVal
|