Flutter Engine
The Flutter Engine
|
Classes | |
interface | MethodCallHandler |
interface | Result |
Public Member Functions | |
MethodChannel (@NonNull BinaryMessenger messenger, @NonNull String name) | |
MethodChannel ( @NonNull BinaryMessenger messenger, @NonNull String name, @NonNull MethodCodec codec) | |
MethodChannel ( @NonNull BinaryMessenger messenger, @NonNull String name, @NonNull MethodCodec codec, @Nullable BinaryMessenger.TaskQueue taskQueue) | |
void | invokeMethod (@NonNull String method, @Nullable Object arguments) |
void | invokeMethod ( @NonNull String method, @Nullable Object arguments, @Nullable Result callback) |
void | setMethodCallHandler (final @Nullable MethodCallHandler handler) |
void | resizeChannelBuffer (int newSize) |
void | setWarnsOnChannelOverflow (boolean warns) |
A named channel for communicating with the Flutter application using asynchronous method calls.
Incoming method calls are decoded from binary on receipt, and Java results are encoded into binary before being transmitted back to Flutter. The MethodCodec
used must be compatible with the one used by the Flutter application. This can be achieved by creating a MethodChannel counterpart of this channel on the Dart side. The Java type of method call arguments and results is Object
, but only values supported by the specified MethodCodec
can be used.
The logical identity of the channel is given by its name. Identically named channels will interfere with each other's communication.
Definition at line 29 of file MethodChannel.java.
|
inline |
Creates a new channel associated with the specified BinaryMessenger
and with the specified name and the standard MethodCodec
.
messenger | a BinaryMessenger . |
name | a channel name String. |
Definition at line 44 of file MethodChannel.java.
|
inline |
Creates a new channel associated with the specified BinaryMessenger
and with the specified name and MethodCodec
.
messenger | a BinaryMessenger . |
name | a channel name String. |
codec | a MessageCodec . |
Definition at line 56 of file MethodChannel.java.
|
inline |
Creates a new channel associated with the specified BinaryMessenger
and with the specified name and MethodCodec
.
messenger | a BinaryMessenger . |
name | a channel name String. |
codec | a MessageCodec . |
taskQueue | a BinaryMessenger.TaskQueue that specifies what thread will execute the handler. Specifying null means execute on the platform thread. See also BinaryMessenger#makeBackgroundTaskQueue() . |
Definition at line 72 of file MethodChannel.java.
|
inline |
Invokes a method on this channel, optionally expecting a result.
Any uncaught exception thrown by the result callback will be caught and logged.
method | the name String of the method. |
arguments | the arguments for the invocation, possibly null. |
callback | a Result callback for the invocation result, or null. |
Definition at line 115 of file MethodChannel.java.
|
inline |
Invokes a method on this channel, expecting no result.
method | the name String of the method. |
arguments | the arguments for the invocation, possibly null. |
Definition at line 101 of file MethodChannel.java.
|
inline |
Adjusts the number of messages that will get buffered when sending messages to channels that aren't fully set up yet. For example, the engine isn't running yet or the channel's message handler isn't set up on the Dart side yet.
Definition at line 156 of file MethodChannel.java.
|
inline |
Registers a method call handler on this channel.
Overrides any existing handler registration for (the name of) this channel.
If no handler has been registered, any incoming method call on this channel will be handled silently by sending a null reply. This results in a MissingPluginException on the Dart side, unless an OptionalMethodChannel is used.
handler | a MethodCallHandler , or null to deregister. |
Definition at line 138 of file MethodChannel.java.
|
inline |
Toggles whether the channel should show warning messages when discarding messages due to overflow. When 'warns' is false the channel is expected to overflow and warning messages will not be shown.
Definition at line 165 of file MethodChannel.java.