5package io.flutter.plugin.common;
7import androidx.annotation.NonNull;
9import io.flutter.plugin.common.StandardMessageCodec.ExposedByteArrayOutputStream;
10import java.nio.ByteBuffer;
11import java.nio.ByteOrder;
30 this.messageCodec = messageCodec;
39 final ByteBuffer
buffer = ByteBuffer.allocateDirect(
stream.size());
47 methodCall.order(ByteOrder.nativeOrder());
48 final Object method = messageCodec.
readValue(methodCall);
49 final Object arguments = messageCodec.
readValue(methodCall);
50 if (method instanceof String && !methodCall.hasRemaining()) {
51 return new MethodCall((String) method, arguments);
53 throw new IllegalArgumentException(
"Method call corrupted");
62 final ByteBuffer
buffer = ByteBuffer.allocateDirect(
stream.size());
70 @NonNull String errorCode, @NonNull String errorMessage, @NonNull Object errorDetails) {
75 if (errorDetails instanceof Throwable) {
80 final ByteBuffer
buffer = ByteBuffer.allocateDirect(
stream.size());
88 @NonNull String errorCode,
89 @NonNull String errorMessage,
90 @NonNull Object errorDetails,
91 @NonNull String errorStacktrace) {
96 if (errorDetails instanceof Throwable) {
102 final ByteBuffer
buffer = ByteBuffer.allocateDirect(
stream.size());
110 envelope.order(ByteOrder.nativeOrder());
111 final byte flag = envelope.get();
116 if (!envelope.hasRemaining()) {
125 final Object details = messageCodec.
readValue(envelope);
126 if (
code instanceof String
128 && !envelope.hasRemaining()) {
133 throw new IllegalArgumentException(
"Envelope corrupted");
static String getStackTraceString(@Nullable Throwable tr)
final Object readValue(@NonNull ByteBuffer buffer)
void writeValue(@NonNull ByteArrayOutputStream stream, @Nullable Object value)
static final StandardMessageCodec INSTANCE
StandardMethodCodec(@NonNull StandardMessageCodec messageCodec)
ByteBuffer encodeSuccessEnvelope(@NonNull Object result)
ByteBuffer encodeErrorEnvelopeWithStacktrace( @NonNull String errorCode, @NonNull String errorMessage, @NonNull Object errorDetails, @NonNull String errorStacktrace)
ByteBuffer encodeErrorEnvelope( @NonNull String errorCode, @NonNull String errorMessage, @NonNull Object errorDetails)
Object decodeEnvelope(@NonNull ByteBuffer envelope)
ByteBuffer encodeMethodCall(@NonNull MethodCall methodCall)
MethodCall decodeMethodCall(@NonNull ByteBuffer methodCall)
static final StandardMethodCodec INSTANCE
FlutterSemanticsFlag flag
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer