Flutter Engine
fl_method_response.h File Reference
#include <glib-object.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

GQuark fl_method_response_error_quark (void) G_GNUC_CONST
 
 G_DECLARE_DERIVABLE_TYPE (FlMethodResponse, fl_method_response, FL, METHOD_RESPONSE, GObject) struct _FlMethodResponseClass
 
 G_DECLARE_FINAL_TYPE (FlMethodSuccessResponse, fl_method_success_response, FL, METHOD_SUCCESS_RESPONSE, FlMethodResponse) G_DECLARE_FINAL_TYPE(FlMethodErrorResponse
 
FlMethodResponse 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

 fl_method_error_response
 
 FL
 
 METHOD_ERROR_RESPONSE
 
FlMethodResponse GError ** error
 

Macro Definition Documentation

◆ FL_METHOD_RESPONSE_ERROR

#define FL_METHOD_RESPONSE_ERROR   fl_method_response_error_quark()

FlMethodResponseError: : Call failed due to an unspecified error. : An error was returned by the other side of the channel. : 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 29 of file fl_method_response.h.

Referenced by fl_method_response_get_result(), and TEST().

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 31 of file fl_method_response.h.

Function Documentation

◆ fl_method_response_error_quark()

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: : an #FlMethodSuccessResponse.

Gets the result of the method call.

Returns: an FlValue.

Definition at line 144 of file fl_method_response.cc.

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

145  {
146  g_return_val_if_fail(FL_IS_METHOD_SUCCESS_RESPONSE(self), nullptr);
147  return self->result;
148 }

◆ 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 132 of file fl_method_response.cc.

References fl_method_success_response_get_type(), and fl_value_ref().

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(), hide(), set_client(), set_editable_size_and_transform(), set_editing_state(), set_marked_text_rect(), show(), system_navigator_pop(), and TEST().

133  {
134  FlMethodSuccessResponse* self = FL_METHOD_SUCCESS_RESPONSE(
135  g_object_new(fl_method_success_response_get_type(), nullptr));
136 
137  if (result != nullptr) {
138  self->result = fl_value_ref(result);
139  }
140 
141  return self;
142 }
G_MODULE_EXPORT GType fl_method_success_response_get_type()
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:335

◆ G_DECLARE_DERIVABLE_TYPE()

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

Definition at line 39 of file fl_method_response.h.

References FL, and G_DECLARE_FINAL_TYPE().

45  {
46  GObjectClass parent_class;
47 };

◆ G_DECLARE_FINAL_TYPE() [1/2]

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

◆ G_DECLARE_FINAL_TYPE() [2/2]

FlMethodResponse 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_ERROR_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: : an #FlMethodResponse. : (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.

Variable Documentation

◆ error

FlMethodResponse GError** error

Definition at line 131 of file fl_method_response.h.

Referenced by vulkan::VulkanSwapchain::AcquireSurface(), bool_failure(), cancel_exception_response_cb(), FlutterStandardMethodCodec::codecWithReaderWriter:, flutter::DartIsolate::CreateRunningRootIsolate(), decode_error_message(), decode_error_method_call(), decode_error_response(), decode_error_value(), decode_message(), decode_method_call(), decode_response_with_error(), decode_response_with_success(), echo_response_cb(), eglGetError(), encode_error_envelope(), encode_error_message(), encode_message(), encode_message_error(), encode_method_call(), encode_success_envelope(), error_response_cb(), failure_response_cb(), fl_basic_message_channel_send(), fl_engine_gl_clear_current(), fl_engine_gl_make_current(), fl_engine_gl_make_resource_current(), fl_engine_gl_present(), fl_method_channel_invoke_method(), fl_view_realize(), FlutterEngineCreateAOTData(), FlutterEngineSendPlatformMessage(), G_DECLARE_DERIVABLE_TYPE(), get_executable_dir(), flutter::testing::GetEGLError(), flutter::UIDartState::GetLastError(), flutter::Win32Window::InitializeChild(), FlutterEventChannel::initWithName:binaryMessenger:codec:, invoke_method(), listen_exception_response_cb(), dart_utils::ElfSnapshot::Load(), flutter::testing::LoadELFSymbolFromFixturesIfNeccessary(), tonic::FileLoader::LoadPackagesMap(), LogEmbedderError(), FlutterCallbackCache::lookupCallbackInformation:, dart_runner::DartComponentController::Main(), main(), flutter_runner::MakeDataFileMapping(), message_cb(), method_call_cb(), method_call_error_cb(), method_call_error_response_cb(), method_call_not_implemented_cb(), method_call_not_implemented_response_cb(), method_call_success_cb(), method_call_success_response_cb(), method_response_cb(), not_implemented_response_cb(), nullptr_args_response_cb(), nullptr_response_cb(), flutter::StreamHandlerFunctions< T >::OnCancelInternal(), tonic::DartMessageHandler::OnHandleMessage(), flutter::StreamHandlerFunctions< T >::OnListenInternal(), flutter::ParseBase64(), perform_action_response_cb(), flutter::UIDartState::platform_configuration(), flutter_runner::PlatformView::PlatformView(), flutter::DartIsolate::PrepareForRunningFromKernels(), tonic::DartMicrotaskQueue::RunMicrotasks(), send_events_events_cb(), send_events_listen_cb(), send_response(), flutter::EventChannel< T >::SetStreamHandler(), flutter::DartIsolate::Shutdown(), txt::RenderTest::Snapshot(), TEST(), update_editing_state_response_cb(), and flutter_runner::Engine::WriteProfileToTrace().

◆ FL

FL

Definition at line 56 of file fl_method_response.h.

Referenced by G_DECLARE_DERIVABLE_TYPE().

◆ fl_method_error_response

fl_method_error_response

Definition at line 56 of file fl_method_response.h.

◆ METHOD_ERROR_RESPONSE

METHOD_ERROR_RESPONSE

Definition at line 56 of file fl_method_response.h.