| Flutter Linux Embedder |

Functions
fl_method_channel_private.h File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_channel.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_response.h"`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS gboolean | fl_method_channel_respond (FlMethodChannel *channel, FlBinaryMessengerResponseHandle *response_handle, FlMethodResponse *response, GError **error)

## Function Documentation

## ◆ fl_method_channel_respond()

G_BEGIN_DECLS gboolean fl_method_channel_respond | ( | FlMethodChannel * | channel,
|  | FlBinaryMessengerResponseHandle * | response_handle,
|  | FlMethodResponse * | response,
|  | GError ** | error
| ) |  |

fl_method_channel_respond: @channel: an #FlMethodChannel. @response_handle: an #FlBinaryMessengerResponseHandle. @response: an #FlMethodResponse. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Responds to a method call.

Returns: TRUE on success.

Definition at line 211 of file fl_method_channel.cc.

215 {
216 g_return_val_if_fail(FL_IS_METHOD_CHANNEL(self), FALSE);
217 g_return_val_if_fail(FL_IS_BINARY_MESSENGER_RESPONSE_HANDLE(response_handle),
218 FALSE);
219 g_return_val_if_fail(FL_IS_METHOD_SUCCESS_RESPONSE(response) ||
220 FL_IS_METHOD_ERROR_RESPONSE(response) ||
221 FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response),
222 FALSE);
223
224 g_autoptr(GBytes) message = nullptr;
225 if (FL_IS_METHOD_SUCCESS_RESPONSE(response)) {
226 FlMethodSuccessResponse* r = FL_METHOD_SUCCESS_RESPONSE(response);
227 message = fl_method_codec_encode_success_envelope(
228 self->codec, fl_method_success_response_get_result(r), error);
229 if (message == nullptr) {
230 return FALSE;
231 }
232 } else if (FL_IS_METHOD_ERROR_RESPONSE(response)) {
233 FlMethodErrorResponse* r = FL_METHOD_ERROR_RESPONSE(response);
234 message = fl_method_codec_encode_error_envelope(
235 self->codec, fl_method_error_response_get_code(r),
236 fl_method_error_response_get_message(r),
237 fl_method_error_response_get_details(r), error);
238 if (message == nullptr) {
239 return FALSE;
240 }
241 } else if (FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response)) {
242 message = nullptr;
243 } else {
244 g_assert_not_reached();
245 }
246
247 return fl_binary_messenger_send_response(self->messenger, response_handle,
248 message, error);
249 }

References error, fl_binary_messenger_send_response(), fl_method_codec_encode_error_envelope(), fl_method_codec_encode_success_envelope(), fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), and fl_method_success_response_get_result().

Referenced by fl_method_call_respond(), fl_method_call_respond_error(), fl_method_call_respond_not_implemented(), and fl_method_call_respond_success().

fl_method_error_response_get_message
const G_MODULE_EXPORT gchar * fl_method_error_response_get_message(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:166
fl_method_error_response_get_details
G_MODULE_EXPORT FlValue * fl_method_error_response_get_details(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:172
fl_method_success_response_get_result
G_MODULE_EXPORT FlValue * fl_method_success_response_get_result(FlMethodSuccessResponse *self)
Definition: fl_method_response.cc:138
fl_method_codec_encode_success_envelope
GBytes * fl_method_codec_encode_success_envelope(FlMethodCodec *self, FlValue *result, GError **error)
Definition: fl_method_codec.cc:41
fl_method_error_response_get_code
const G_MODULE_EXPORT gchar * fl_method_error_response_get_code(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:160
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_method_codec_encode_error_envelope
GBytes * fl_method_codec_encode_error_envelope(FlMethodCodec *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
Definition: fl_method_codec.cc:50
fl_binary_messenger_send_response
G_MODULE_EXPORT gboolean fl_binary_messenger_send_response(FlBinaryMessenger *self, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error)
Definition: fl_binary_messenger.cc:430