public class FlutterNativeView extends Object implements BinaryMessenger
BinaryMessenger.BinaryMessageHandler, BinaryMessenger.BinaryReply| Constructor and Description |
|---|
FlutterNativeView(Context context) |
FlutterNativeView(Context context,
boolean isBackgroundView) |
| Modifier and Type | Method and Description |
|---|---|
void |
assertAttached() |
void |
attachViewAndActivity(FlutterView flutterView,
Activity activity) |
void |
destroy() |
void |
detach() |
static String |
getObservatoryUri() |
FlutterPluginRegistry |
getPluginRegistry() |
boolean |
isApplicationRunning() |
boolean |
isAttached() |
void |
runFromBundle(FlutterRunArguments args) |
void |
runFromBundle(String bundlePath,
String defaultPath,
String entrypoint,
boolean reuseRuntimeController)
Deprecated.
Please use runFromBundle with `FlutterRunArguments`.
Parameter `reuseRuntimeController` has no effect.
|
void |
send(String channel,
ByteBuffer message)
Sends a binary message to the Flutter application.
|
void |
send(String channel,
ByteBuffer message,
BinaryMessenger.BinaryReply callback)
Sends a binary message to the Flutter application, optionally expecting a reply.
|
void |
setMessageHandler(String channel,
BinaryMessenger.BinaryMessageHandler handler)
Registers a handler to be invoked when the Flutter application sends a message
to its host platform.
|
public FlutterNativeView(Context context)
public FlutterNativeView(Context context, boolean isBackgroundView)
public void detach()
public void destroy()
public FlutterPluginRegistry getPluginRegistry()
public void attachViewAndActivity(FlutterView flutterView, Activity activity)
public boolean isAttached()
public void assertAttached()
public void runFromBundle(FlutterRunArguments args)
@Deprecated public void runFromBundle(String bundlePath, String defaultPath, String entrypoint, boolean reuseRuntimeController)
public boolean isApplicationRunning()
public static String getObservatoryUri()
public void send(String channel, ByteBuffer message)
BinaryMessengersend in interface BinaryMessengerchannel - the name String of the logical channel used for the message.message - the message payload, a direct-allocated ByteBuffer with the message bytes
between position zero and current position, or null.public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply callback)
BinaryMessengerAny uncaught exception thrown by the reply callback will be caught and logged.
send in interface BinaryMessengerchannel - the name String of the logical channel used for the message.message - the message payload, a direct-allocated ByteBuffer with the message bytes
between position zero and current position, or null.callback - a BinaryMessenger.BinaryReply callback invoked when the Flutter application responds to the
message, possibly null.public void setMessageHandler(String channel, BinaryMessenger.BinaryMessageHandler handler)
BinaryMessengerRegistration overwrites any previous registration for the same channel name. Use a null handler to deregister.
If no handler has been registered for a particular channel, any incoming message on that channel will be handled silently by sending a null reply.
setMessageHandler in interface BinaryMessengerchannel - the name String of the channel.handler - a BinaryMessenger.BinaryMessageHandler to be invoked on incoming messages, or null.