Package io.flutter.embedding.engine
Class FlutterEngineCache
java.lang.Object
io.flutter.embedding.engine.FlutterEngineCache
Static singleton cache that holds
FlutterEngine
instances
identified by String
s.
The ID of a given FlutterEngine
can be whatever
String
is desired.
FlutterEngineCache
is useful for storing pre-warmed FlutterEngine
instances. FlutterActivity
and FlutterFragment
use the FlutterEngineCache
singleton
internally when instructed to use a cached FlutterEngine
based on a given ID. See FlutterActivity.CachedEngineIntentBuilder
and FlutterFragment.withCachedEngine(String)
for related APIs.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes allFlutterEngine
's that are currently in the cache.boolean
Returns theFlutterEngine
in this cache that is associated with the givenengineId
, ornull
is no suchFlutterEngine
exists.static FlutterEngineCache
Returns the static singleton instance ofFlutterEngineCache
.void
put
(String engineId, FlutterEngine engine) Places the givenFlutterEngine
in this cache and associates it with the givenengineId
.void
Removes anyFlutterEngine
that is currently in the cache that is identified by the givenengineId
.
-
Method Details
-
getInstance
Returns the static singleton instance ofFlutterEngineCache
.Creates a new instance if one does not yet exist.
-
contains
-
get
Returns theFlutterEngine
in this cache that is associated with the givenengineId
, ornull
is no suchFlutterEngine
exists. -
put
Places the givenFlutterEngine
in this cache and associates it with the givenengineId
.If a
FlutterEngine
already exists in this cache for the givenengineId
, thatFlutterEngine
is removed from this cache. -
remove
Removes anyFlutterEngine
that is currently in the cache that is identified by the givenengineId
. -
clear
public void clear()Removes allFlutterEngine
's that are currently in the cache.
-