Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
Loading...
Searching...
No Matches
fl_method_codec.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CODEC_H_
6
#define FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CODEC_H_
7
8
#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
9
#error "Only <flutter_linux/flutter_linux.h> can be included directly."
10
#endif
11
12
#include <glib-object.h>
13
#include <gmodule.h>
14
15
#include "
fl_method_response.h
"
16
#include "
fl_value.h
"
17
18
G_BEGIN_DECLS
19
20
G_MODULE_EXPORT
21
G_DECLARE_DERIVABLE_TYPE
(FlMethodCodec,
22
fl_method_codec,
23
FL
,
24
METHOD_CODEC,
25
GObject)
26
27
/**
28
* FlMethodCodec:
29
*
30
* #FlMethodCodec is an abstract class that encodes and decodes method calls on
31
* a platform channel. Override this class to implement an encoding.
32
*
33
* #FlMethodCodec matches the MethodCodec class in the Flutter services
34
* library.
35
*/
36
37
struct
_FlMethodCodecClass {
38
GObjectClass parent_class;
39
40
/**
41
* FlMethodCodec::encode_method_call:
42
* @codec: an #FlMethodCodec.
43
* @name: method name.
44
* @args: (allow-none): method arguments, or %NULL.
45
* @error: (allow-none): #GError location to store the error occurring, or
46
* %NULL. If `error` is not %NULL, `*error` must be initialized (typically
47
* %NULL, but an error from a previous call using GLib error handling is
48
* explicitly valid).
49
*
50
* Encodes a method call.
51
*
52
* Returns: (transfer full): a binary encoding of this method call or %NULL if
53
* not able to encode.
54
*/
55
GBytes* (*encode_method_call)(FlMethodCodec* codec,
56
const
gchar*
name
,
57
FlValue
*
args
,
58
GError**
error
);
59
60
/**
61
* FlMethodCodec::decode_method_call:
62
* @codec: an #FlMethodCodec
63
* @message: message to decode.
64
* @name: (transfer full): location to write method name or %NULL if not
65
* required
66
* @args: (transfer full): location to write method arguments, or %NULL if not
67
* required
68
* @error: (allow-none): #GError location to store the error occurring, or
69
* %NULL. If `error` is not %NULL, `*error` must be initialized (typically
70
* %NULL, but an error from a previous call using GLib error handling is
71
* explicitly valid).
72
*
73
* Decodes a method call.
74
*
75
* Returns: %TRUE if successfully decoded.
76
*/
77
gboolean (*
decode_method_call
)(FlMethodCodec* codec,
78
GBytes*
message
,
79
gchar**
name
,
80
FlValue
**
args
,
81
GError**
error
);
82
83
/**
84
* FlMethodCodec::encode_success_envelope:
85
* @codec: an #FlMethodCodec.
86
* @result: (allow-none): method result, or %NULL.
87
* @error: (allow-none): #GError location to store the error occurring, or
88
* %NULL. If `error` is not %NULL, `*error` must be initialized (typically
89
* %NULL, but an error from a previous call using GLib error handling is
90
* explicitly valid).
91
*
92
* Encodes a successful response to a method call.
93
*
94
* Returns: (transfer full): a binary encoding of this response or %NULL if
95
* not able to encode.
96
*/
97
GBytes* (*encode_success_envelope)(FlMethodCodec* codec,
98
FlValue
* result,
99
GError**
error
);
100
101
/**
102
* FlMethodCodec::encode_error_envelope:
103
* @codec: an #FlMethodCodec.
104
* @code: an error code.
105
* @message: (allow-none): an error message, or %NULL.
106
* @details: (allow-none): error details, or %NULL.
107
* @error: (allow-none): #GError location to store the error occurring, or
108
* %NULL. If `error` is not %NULL, `*error` must be initialized (typically
109
* %NULL, but an error from a previous call using GLib error handling is
110
* explicitly valid).
111
*
112
* Encodes an error response to a method call.
113
*
114
* Returns: (transfer full): a binary encoding of this response or %NULL if
115
* not able to encode.
116
*/
117
GBytes* (*encode_error_envelope)(FlMethodCodec* codec,
118
const
gchar* code,
119
const
gchar*
message
,
120
FlValue
* details,
121
GError**
error
);
122
123
/**
124
* FlMethodCodec::decode_response:
125
* @codec: an #FlMethodCodec.
126
* @message: message to decode.
127
* @error: (allow-none): #GError location to store the error occurring, or
128
* %NULL. If `error` is not %NULL, `*error` must be initialized (typically
129
* %NULL, but an error from a previous call using GLib error handling is
130
* explicitly valid).
131
*
132
* Decodes a response to a method call.
133
*
134
* Returns: a new #FlMethodResponse or %NULL on error.
135
*/
136
FlMethodResponse* (*decode_response)(FlMethodCodec* codec,
137
GBytes*
message
,
138
GError**
error
);
139
};
140
141
G_END_DECLS
142
143
#endif
// FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CODEC_H_
message
const char * message
Definition
fl_accessibility_handler.cc:21
G_DECLARE_DERIVABLE_TYPE
G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE(FlAccessibilityHandler, fl_accessibility_handler, FL, ACCESSIBILITY_HANDLER, GObject)
FL
FL
Definition
fl_binary_messenger.cc:27
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition
fl_event_channel.h:89
decode_method_call
static void decode_method_call(const char *text, gchar **name, FlValue **args)
Definition
fl_json_method_codec_test.cc:66
fl_method_response.h
error
const uint8_t uint32_t uint32_t GError ** error
Definition
fl_pixel_buffer_texture_test.cc:40
fl_value.h
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition
fl_value.h:42
name
const char * name
Definition
fuchsia.cc:49
shell
platform
linux
public
flutter_linux
fl_method_codec.h
Generated on Wed Dec 31 2025 04:49:50 for Flutter Engine Uber Docs by
1.9.8