Package io.flutter.embedding.engine
Class FlutterEngineCache
java.lang.Object
io.flutter.embedding.engine.FlutterEngineCache
Static singleton cache that holds
FlutterEngine instances
identified by Strings.
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 TypeMethodDescriptionvoidclear()Removes allFlutterEngine's that are currently in the cache.booleanReturns theFlutterEnginein this cache that is associated with the givenengineId, ornullis no suchFlutterEngineexists.static FlutterEngineCacheReturns the static singleton instance ofFlutterEngineCache.voidput(String engineId, FlutterEngine engine) Places the givenFlutterEnginein this cache and associates it with the givenengineId.voidRemoves anyFlutterEnginethat 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 theFlutterEnginein this cache that is associated with the givenengineId, ornullis no suchFlutterEngineexists. -
put
Places the givenFlutterEnginein this cache and associates it with the givenengineId.If a
FlutterEnginealready exists in this cache for the givenengineId, thatFlutterEngineis removed from this cache. -
remove
Removes anyFlutterEnginethat is currently in the cache that is identified by the givenengineId. -
clear
public void clear()Removes allFlutterEngine's that are currently in the cache.
-