Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | Package Functions | List of all members
io.flutter.view.FlutterNativeView Class Reference
Inheritance diagram for io.flutter.view.FlutterNativeView:
io.flutter.plugin.common.BinaryMessenger

Public Member Functions

 FlutterNativeView (@NonNull Context context)
 
 FlutterNativeView (@NonNull Context context, boolean isBackgroundView)
 
void detachFromFlutterView ()
 
void destroy ()
 
DartExecutor getDartExecutor ()
 
FlutterPluginRegistry getPluginRegistry ()
 
void attachViewAndActivity (FlutterView flutterView, Activity activity)
 
boolean isAttached ()
 
void assertAttached ()
 
void runFromBundle (FlutterRunArguments args)
 
boolean isApplicationRunning ()
 
TaskQueue makeBackgroundTaskQueue (TaskQueueOptions options)
 
void send (String channel, ByteBuffer message)
 
void send (String channel, ByteBuffer message, BinaryReply callback)
 
void setMessageHandler (String channel, BinaryMessageHandler handler)
 
void setMessageHandler (String channel, BinaryMessageHandler handler, TaskQueue taskQueue)
 
void enableBufferingIncomingMessages ()
 
void disableBufferingIncomingMessages ()
 
- Public Member Functions inherited from io.flutter.plugin.common.BinaryMessenger
default TaskQueue makeBackgroundTaskQueue ()
 
default TaskQueue makeBackgroundTaskQueue (TaskQueueOptions options)
 
void send (@NonNull String channel, @Nullable ByteBuffer message)
 
void send (@NonNull String channel, @Nullable ByteBuffer message, @Nullable BinaryReply callback)
 
void setMessageHandler (@NonNull String channel, @Nullable BinaryMessageHandler handler)
 
default void setMessageHandler ( @NonNull String channel, @Nullable BinaryMessageHandler handler, @Nullable TaskQueue taskQueue)
 
default void enableBufferingIncomingMessages ()
 
default void disableBufferingIncomingMessages ()
 

Static Public Member Functions

static String getObservatoryUri ()
 
static String getVMServiceUri ()
 

Package Functions

FlutterJNI getFlutterJNI ()
 

Detailed Description

Deprecated:
io.flutter.embedding.android.FlutterView is the new API that now replaces this class. See https://flutter.dev/go/android-project-migration for more migration details.

Definition at line 25 of file FlutterNativeView.java.

Constructor & Destructor Documentation

◆ FlutterNativeView() [1/2]

io.flutter.view.FlutterNativeView.FlutterNativeView ( @NonNull Context  context)
inline

Definition at line 51 of file FlutterNativeView.java.

51 {
52 this(context, false);
53 }

◆ FlutterNativeView() [2/2]

io.flutter.view.FlutterNativeView.FlutterNativeView ( @NonNull Context  context,
boolean  isBackgroundView 
)
inline

Definition at line 55 of file FlutterNativeView.java.

55 {
56 if (isBackgroundView) {
57 Log.w(TAG, "'isBackgroundView' is no longer supported and will be ignored");
58 }
59 mContext = context;
60 mPluginRegistry = new FlutterPluginRegistry(this, context);
61 mFlutterJNI = new FlutterJNI();
62 mFlutterJNI.addIsDisplayingFlutterUiListener(flutterUiDisplayListener);
63 this.dartExecutor = new DartExecutor(mFlutterJNI, context.getAssets());
64 mFlutterJNI.addEngineLifecycleListener(new EngineLifecycleListenerImpl());
65 attach(this);
67 }
static void w(@NonNull String tag, @NonNull String message)
Definition: Log.java:76
void addIsDisplayingFlutterUiListener(@NonNull FlutterUiDisplayListener listener)
void addEngineLifecycleListener(@NonNull EngineLifecycleListener engineLifecycleListener)

Member Function Documentation

◆ assertAttached()

void io.flutter.view.FlutterNativeView.assertAttached ( )
inline

Definition at line 102 of file FlutterNativeView.java.

102 {
103 if (!isAttached()) throw new AssertionError("Platform view is not attached");
104 }

◆ attachViewAndActivity()

void io.flutter.view.FlutterNativeView.attachViewAndActivity ( FlutterView  flutterView,
Activity  activity 
)
inline

Definition at line 93 of file FlutterNativeView.java.

93 {
94 mFlutterView = flutterView;
95 mPluginRegistry.attach(flutterView, activity);
96 }
void attach(FlutterView flutterView, Activity activity)

◆ destroy()

void io.flutter.view.FlutterNativeView.destroy ( )
inline

Definition at line 74 of file FlutterNativeView.java.

74 {
75 mPluginRegistry.destroy();
76 dartExecutor.onDetachedFromJNI();
77 mFlutterView = null;
78 mFlutterJNI.removeIsDisplayingFlutterUiListener(flutterUiDisplayListener);
80 applicationIsRunning = false;
81 }
void removeIsDisplayingFlutterUiListener(@NonNull FlutterUiDisplayListener listener)

◆ detachFromFlutterView()

void io.flutter.view.FlutterNativeView.detachFromFlutterView ( )
inline

Definition at line 69 of file FlutterNativeView.java.

69 {
70 mPluginRegistry.detach();
71 mFlutterView = null;
72 }

◆ disableBufferingIncomingMessages()

void io.flutter.view.FlutterNativeView.disableBufferingIncomingMessages ( )
inline

Disables the ability to queue messages received from Dart.

This can be used after all pending channel handlers have been registered.

Implements io.flutter.plugin.common.BinaryMessenger.

Definition at line 175 of file FlutterNativeView.java.

175{}

◆ enableBufferingIncomingMessages()

void io.flutter.view.FlutterNativeView.enableBufferingIncomingMessages ( )
inline

Enables the ability to queue messages received from Dart.

This is useful when there are pending channel handler registrations. For example, Dart may be initialized concurrently, and prior to the registration of the channel handlers. This implies that Dart may start sending messages while plugins are being registered.

Implements io.flutter.plugin.common.BinaryMessenger.

Definition at line 172 of file FlutterNativeView.java.

172{}

◆ getDartExecutor()

DartExecutor io.flutter.view.FlutterNativeView.getDartExecutor ( )
inline

Definition at line 84 of file FlutterNativeView.java.

84 {
85 return dartExecutor;
86 }

◆ getFlutterJNI()

FlutterJNI io.flutter.view.FlutterNativeView.getFlutterJNI ( )
inlinepackage

Definition at line 177 of file FlutterNativeView.java.

177 {
178 return mFlutterJNI;
179 }

◆ getObservatoryUri()

static String io.flutter.view.FlutterNativeView.getObservatoryUri ( )
inlinestatic

Definition at line 128 of file FlutterNativeView.java.

128 {
130 }

◆ getPluginRegistry()

FlutterPluginRegistry io.flutter.view.FlutterNativeView.getPluginRegistry ( )
inline

Definition at line 89 of file FlutterNativeView.java.

89 {
90 return mPluginRegistry;
91 }

◆ getVMServiceUri()

static String io.flutter.view.FlutterNativeView.getVMServiceUri ( )
inlinestatic

Definition at line 132 of file FlutterNativeView.java.

132 {
134 }

◆ isApplicationRunning()

boolean io.flutter.view.FlutterNativeView.isApplicationRunning ( )
inline

Definition at line 123 of file FlutterNativeView.java.

123 {
124 return applicationIsRunning;
125 }

◆ isAttached()

boolean io.flutter.view.FlutterNativeView.isAttached ( )
inline

Definition at line 98 of file FlutterNativeView.java.

98 {
99 return mFlutterJNI.isAttached();
100 }

◆ makeBackgroundTaskQueue()

TaskQueue io.flutter.view.FlutterNativeView.makeBackgroundTaskQueue ( TaskQueueOptions  options)
inline

Creates a TaskQueue that executes the tasks serially on a background thread.

TaskQueueOptions can be used to configure the task queue to execute tasks concurrently. Doing so can be more performant, though users need to ensure that the task handlers are thread-safe.

Implements io.flutter.plugin.common.BinaryMessenger.

Definition at line 138 of file FlutterNativeView.java.

138 {
140 }
const char * options

◆ runFromBundle()

void io.flutter.view.FlutterNativeView.runFromBundle ( FlutterRunArguments  args)
inline

Definition at line 106 of file FlutterNativeView.java.

106 {
107 if (args.entrypoint == null) {
108 throw new AssertionError("An entrypoint must be specified");
109 }
111 if (applicationIsRunning)
112 throw new AssertionError("This Flutter engine instance is already running an application");
114 args.bundlePath,
115 args.entrypoint,
116 args.libraryPath,
117 mContext.getResources().getAssets(),
118 null);
119
120 applicationIsRunning = true;
121 }
void runBundleAndSnapshotFromLibrary( @NonNull String bundlePath, @Nullable String entrypointFunctionName, @Nullable String pathToEntrypointFunction, @NonNull AssetManager assetManager, @Nullable List< String > entrypointArgs)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ send() [1/2]

void io.flutter.view.FlutterNativeView.send ( String  channel,
ByteBuffer  message 
)
inline

Definition at line 144 of file FlutterNativeView.java.

144 {
145 dartExecutor.getBinaryMessenger().send(channel, message);
146 }
void send(@NonNull String channel, @Nullable ByteBuffer message)
Win32Message message

◆ send() [2/2]

void io.flutter.view.FlutterNativeView.send ( String  channel,
ByteBuffer  message,
BinaryReply  callback 
)
inline

Definition at line 150 of file FlutterNativeView.java.

150 {
151 if (!isAttached()) {
152 Log.d(TAG, "FlutterView.send called on a detached view, channel=" + channel);
153 return;
154 }
155
156 dartExecutor.getBinaryMessenger().send(channel, message, callback);
157 }
static void d(@NonNull String tag, @NonNull String message)
Definition: Log.java:64
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ setMessageHandler() [1/2]

void io.flutter.view.FlutterNativeView.setMessageHandler ( String  channel,
BinaryMessageHandler  handler 
)
inline

Definition at line 161 of file FlutterNativeView.java.

161 {
162 dartExecutor.getBinaryMessenger().setMessageHandler(channel, handler);
163 }
void setMessageHandler(@NonNull String channel, @Nullable BinaryMessageHandler handler)

◆ setMessageHandler() [2/2]

void io.flutter.view.FlutterNativeView.setMessageHandler ( String  channel,
BinaryMessageHandler  handler,
TaskQueue  taskQueue 
)
inline

Definition at line 167 of file FlutterNativeView.java.

167 {
168 dartExecutor.getBinaryMessenger().setMessageHandler(channel, handler, taskQueue);
169 }

The documentation for this class was generated from the following file: