Flutter Linux Embedder
fl_method_response.h File Reference
#include <glib-object.h>
#include <gmodule.h>
#include "fl_value.h"

Go to the source code of this file.

Macros

#define FL_METHOD_RESPONSE_ERROR   fl_method_response_error_quark()
 

Enumerations

enum  FlMethodResponseError {
  FL_METHOD_RESPONSE_ERROR_FAILED,
  FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR,
  FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED
}
 

Functions

G_MODULE_EXPORT GQuark fl_method_response_error_quark (void) G_GNUC_CONST
 
G_MODULE_EXPORT G_DECLARE_DERIVABLE_TYPE (FlMethodResponse, fl_method_response, FL, METHOD_RESPONSE, GObject) struct _FlMethodResponseClass
 
G_MODULE_EXPORT G_DECLARE_FINAL_TYPE (FlMethodSuccessResponse, fl_method_success_response, FL, METHOD_SUCCESS_RESPONSE, FlMethodResponse) G_MODULE_EXPORT G_DECLARE_FINAL_TYPE(FlMethodErrorResponse
 
G_MODULE_EXPORT FlMethodResponse G_MODULE_EXPORT G_DECLARE_FINAL_TYPE (FlMethodNotImplementedResponse, fl_method_not_implemented_response, FL, METHOD_NOT_IMPLEMENTED_RESPONSE, FlMethodResponse) FlValue *fl_method_response_get_result(FlMethodResponse *response
 
FlMethodSuccessResponse * fl_method_success_response_new (FlValue *result)
 
FlValuefl_method_success_response_get_result (FlMethodSuccessResponse *response)
 

Variables

G_MODULE_EXPORT fl_method_error_response
 
G_MODULE_EXPORT FL
 
G_MODULE_EXPORT METHOD_ERROR_RESPONSE
 
G_MODULE_EXPORT FlMethodResponse G_MODULE_EXPORT GError ** error
 

Macro Definition Documentation

◆ FL_METHOD_RESPONSE_ERROR

#define FL_METHOD_RESPONSE_ERROR   fl_method_response_error_quark()

FlMethodResponseError: @FL_METHOD_RESPONSE_ERROR_FAILED: Call failed due to an unspecified error. @FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR: An error was returned by the other side of the channel. @FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED: The requested method is not implemented.

Errors set by fl_method_response_get_result when the method call response is not #FlMethodSuccessResponse.

Definition at line 30 of file fl_method_response.h.

Enumeration Type Documentation

◆ FlMethodResponseError

Enumerator
FL_METHOD_RESPONSE_ERROR_FAILED 
FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR 
FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED 

Definition at line 32 of file fl_method_response.h.

32  {
33  // NOLINTBEGIN(readability-identifier-naming)
37  // NOLINTEND(readability-identifier-naming)

Function Documentation

◆ fl_method_response_error_quark()

G_MODULE_EXPORT GQuark fl_method_response_error_quark ( void  )

◆ fl_method_success_response_get_result()

FlValue* fl_method_success_response_get_result ( FlMethodSuccessResponse *  response)

fl_method_success_response_get_result: @response: an #FlMethodSuccessResponse.

Gets the result of the method call.

Returns: an FlValue.

Definition at line 138 of file fl_method_response.cc.

139  {
140  g_return_val_if_fail(FL_IS_METHOD_SUCCESS_RESPONSE(self), nullptr);
141  return self->result;
142 }

Referenced by decode_response_with_success(), fl_method_channel_respond(), fl_method_response_get_result(), method_call_success_response_cb(), and TEST().

◆ fl_method_success_response_new()

FlMethodSuccessResponse* fl_method_success_response_new ( FlValue result)

fl_method_success_response_new:

Returns
: (allow-none): the FlValue returned by the method call or NULL.

Creates a response to a method call when that method has successfully completed.

Returns: a new #FlMethodResponse.

Definition at line 126 of file fl_method_response.cc.

127  {
128  FlMethodSuccessResponse* self = FL_METHOD_SUCCESS_RESPONSE(
129  g_object_new(fl_method_success_response_get_type(), nullptr));
130 
131  if (result != nullptr) {
132  self->result = fl_value_ref(result);
133  }
134 
135  return self;
136 }

References fl_value_ref(), and result.

Referenced by activate_system_cursor(), clear_client(), clipboard_set_data(), clipboard_text_cb(), clipboard_text_has_strings_cb(), fl_json_method_codec_decode_response(), fl_method_call_respond_success(), fl_standard_method_codec_decode_response(), fl_test_codec_decode_response(), get_keyboard_state(), hide(), request_app_exit_response_cb(), set_client(), set_editable_size_and_transform(), set_editing_state(), set_marked_text_rect(), show(), system_exit_application(), system_intitialization_complete(), system_navigator_pop(), system_sound_play(), and TEST().

◆ G_DECLARE_DERIVABLE_TYPE()

G_MODULE_EXPORT G_DECLARE_DERIVABLE_TYPE ( FlMethodResponse  ,
fl_method_response  ,
FL  ,
METHOD_RESPONSE  ,
GObject   
)

Definition at line 44 of file fl_method_response.h.

50  {
51  GObjectClass parent_class;
52 };

◆ G_DECLARE_FINAL_TYPE() [1/2]

G_MODULE_EXPORT FlMethodResponse G_MODULE_EXPORT G_DECLARE_FINAL_TYPE ( FlMethodNotImplementedResponse  ,
fl_method_not_implemented_response  ,
FL  ,
METHOD_NOT_IMPLEMENTED_RESPONSE  ,
FlMethodResponse   
)

FlMethodResponse:

#FlMethodResponse contains the information returned when an #FlMethodChannel method call returns. If you expect the method call to be successful use fl_method_response_get_result(). If you want to handle error cases then you should use code like:

|[ if (FL_IS_METHOD_SUCCESS_RESPONSE (response)) { FlValue *result = fl_method_success_response_get_result( FL_METHOD_SUCCESS_RESPONSE (response)); handle_result (result); } else if (FL_IS_METHOD_ERROR_RESPONSE (response)) { FlMethodErrorResponse *error_response = FL_METHOD_ERROR_RESPONSE (response); handle_error (fl_method_error_response_get_code (error_response), fl_method_error_response_get_message (error_response), fl_method_error_response_get_details (error_response)); } else if (FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE (response)) { handle_not_implemented (); } } ]| FlMethodSuccessResponse:

#FlMethodSuccessResponse is the #FlMethodResponse returned when a method call has successfully completed. The result of the method call is obtained using fl_method_success_response_get_result. FlMethodErrorResponse:

#FlMethodErrorResponse is the #FlMethodResponse returned when a method call results in an error. The error details are obtained using fl_method_error_response_get_code, fl_method_error_response_get_message and fl_method_error_response_get_details. FlMethodNotImplementedResponse:

#FlMethodNotImplementedResponse is the #FlMethodResponse returned when a method call is not implemented. fl_method_response_get_result: @response: an #FlMethodResponse. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Gets the result of a method call, or an error if the response wasn't successful.

Returns: an FlValue or NULL on error.

◆ G_DECLARE_FINAL_TYPE() [2/2]

G_MODULE_EXPORT G_DECLARE_FINAL_TYPE ( FlMethodSuccessResponse  ,
fl_method_success_response  ,
FL  ,
METHOD_SUCCESS_RESPONSE  ,
FlMethodResponse   
)

Variable Documentation

◆ error

G_MODULE_EXPORT FlMethodResponse G_MODULE_EXPORT GError** error

Definition at line 139 of file fl_method_response.h.

◆ FL

G_MODULE_EXPORT FL

Definition at line 64 of file fl_method_response.h.

◆ fl_method_error_response

G_MODULE_EXPORT fl_method_error_response

Definition at line 63 of file fl_method_response.h.

◆ METHOD_ERROR_RESPONSE

G_MODULE_EXPORT METHOD_ERROR_RESPONSE

Definition at line 65 of file fl_method_response.h.

FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR
@ FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR
Definition: fl_method_response.h:35
FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED
@ FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED
Definition: fl_method_response.h:36
FL_METHOD_RESPONSE_ERROR_FAILED
@ FL_METHOD_RESPONSE_ERROR_FAILED
Definition: fl_method_response.h:34
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394
FlMethodResponseError
FlMethodResponseError
Definition: fl_method_response.h:32
result
GAsyncResult * result
Definition: fl_text_input_plugin.cc:106