![]() |
Flutter Engine
The Flutter Engine
|
Public Member Functions | |
RestorationChannel ( @NonNull DartExecutor dartExecutor, @NonNull boolean waitForRestorationData) | |
byte[] | getRestorationData () |
void | setRestorationData (@NonNull byte[] data) |
void | clearData () |
Public Attributes | |
final boolean | waitForRestorationData |
Package Functions | |
RestorationChannel (MethodChannel channel, @NonNull boolean waitForRestorationData) | |
System channel to exchange restoration data between framework and engine.
The engine can obtain the current restoration data from the framework via this channel to store it on disk and - when the app is relaunched - provide the stored data back to the framework to recreate the original state of the app.
The channel can be configured to delay responding to the framework's request for restoration data via waitForRestorationData
until the engine-side has provided the data. This is useful when the engine is pre-warmed at a point in the application's life cycle where the restoration data is not available yet. For example, if the engine is pre-warmed as part of the Application before an Activity is created, this flag should be set to true because Android will only provide the restoration data to the Activity during the onCreate callback.
The current restoration data provided by the framework can be read via
.
getRestorationData()
Definition at line 34 of file RestorationChannel.java.
|
inline |
Definition at line 37 of file RestorationChannel.java.
|
inlinepackage |
Definition at line 44 of file RestorationChannel.java.
|
inline |
Clears the current restoration data.
This should be called just prior to a hot restart. Otherwise, after the hot restart the state prior to the hot restart will get restored.
Definition at line 131 of file RestorationChannel.java.
|
inline |
Obtain the most current restoration data that the framework has provided.
Definition at line 77 of file RestorationChannel.java.
|
inline |
Set the restoration data from which the framework will restore its state.
Definition at line 82 of file RestorationChannel.java.
final boolean io.flutter.embedding.engine.systemchannels.RestorationChannel.waitForRestorationData |
Whether the channel delays responding to the framework's initial request for restoration data until setRestorationData
has been called.
If the engine never calls setRestorationData
this flag must be set to false. If set to true, the engine must call setRestorationData
either with the actual restoration data as argument or null if it turns out that there is no restoration data.
If the response to the framework's request for restoration data is not delayed until the data has been set via setRestorationData
, the framework may intermittently initialize itself to default values until the restoration data has been made available. Setting this flag to true avoids that extra work.
Definition at line 64 of file RestorationChannel.java.