Flutter Engine
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: : an #FlMethodChannel. : an #FlBinaryMessengerResponseHandle. : an #FlMethodResponse. : (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 219 of file fl_method_channel.cc.

References FALSE, 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().

223  {
224  g_return_val_if_fail(FL_IS_METHOD_CHANNEL(self), FALSE);
225  g_return_val_if_fail(FL_IS_BINARY_MESSENGER_RESPONSE_HANDLE(response_handle),
226  FALSE);
227  g_return_val_if_fail(FL_IS_METHOD_SUCCESS_RESPONSE(response) ||
228  FL_IS_METHOD_ERROR_RESPONSE(response) ||
229  FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response),
230  FALSE);
231 
232  g_autoptr(GBytes) message = nullptr;
233  if (FL_IS_METHOD_SUCCESS_RESPONSE(response)) {
234  FlMethodSuccessResponse* r = FL_METHOD_SUCCESS_RESPONSE(response);
237  if (message == nullptr) {
238  return FALSE;
239  }
240  } else if (FL_IS_METHOD_ERROR_RESPONSE(response)) {
241  FlMethodErrorResponse* r = FL_METHOD_ERROR_RESPONSE(response);
243  self->codec, fl_method_error_response_get_code(r),
246  if (message == nullptr) {
247  return FALSE;
248  }
249  } else if (FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response)) {
250  message = nullptr;
251  } else {
252  g_assert_not_reached();
253  }
254 
255  return fl_binary_messenger_send_response(self->messenger, response_handle,
256  message, error);
257 }
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT FlValue * fl_method_success_response_get_result(FlMethodSuccessResponse *self)
G_MODULE_EXPORT const gchar * fl_method_error_response_get_message(FlMethodErrorResponse *self)
G_MODULE_EXPORT gboolean fl_binary_messenger_send_response(FlBinaryMessenger *self, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error)
G_MODULE_EXPORT const gchar * fl_method_error_response_get_code(FlMethodErrorResponse *self)
GBytes * fl_method_codec_encode_error_envelope(FlMethodCodec *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
return FALSE
GBytes * fl_method_codec_encode_success_envelope(FlMethodCodec *self, FlValue *result, GError **error)
G_MODULE_EXPORT FlValue * fl_method_error_response_get_details(FlMethodErrorResponse *self)