Package io.flutter.embedding.engine
Class FlutterEngineGroupCache
- java.lang.Object
-
- io.flutter.embedding.engine.FlutterEngineGroupCache
-
public class FlutterEngineGroupCache extends Object
Static singleton cache that holdsFlutterEngineGroup
instances identified byString
s.The ID of a given
FlutterEngineGroup
can be whateverString
is desired.FlutterActivity
andFlutterFragment
use theFlutterEngineGroupCache
singleton internally when instructed to use a cachedFlutterEngineGroup
based on a given ID. SeeFlutterActivity.NewEngineInGroupIntentBuilder
andFlutterFragment.withNewEngineInGroup(String)
for related APIs.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Removes allFlutterEngineGroup
's that are currently in the cache.boolean
contains(String engineGroupId)
FlutterEngineGroup
get(String engineGroupId)
Returns theFlutterEngineGroup
in this cache that is associated with the givenengineGroupId
, ornull
is no suchFlutterEngineGroup
exists.static FlutterEngineGroupCache
getInstance()
Returns the static singleton instance ofFlutterEngineGroupCache
.void
put(String engineGroupId, FlutterEngineGroup engineGroup)
Places the givenFlutterEngineGroup
in this cache and associates it with the givenengineGroupId
.void
remove(String engineGroupId)
Removes anyFlutterEngineGroup
that is currently in the cache that is identified by the givenengineGroupId
.
-
-
-
Method Detail
-
getInstance
@NonNull public static FlutterEngineGroupCache getInstance()
Returns the static singleton instance ofFlutterEngineGroupCache
.Creates a new instance if one does not yet exist.
-
contains
public boolean contains(@NonNull String engineGroupId)
-
get
@Nullable public FlutterEngineGroup get(@NonNull String engineGroupId)
Returns theFlutterEngineGroup
in this cache that is associated with the givenengineGroupId
, ornull
is no suchFlutterEngineGroup
exists.
-
put
public void put(@NonNull String engineGroupId, @Nullable FlutterEngineGroup engineGroup)
Places the givenFlutterEngineGroup
in this cache and associates it with the givenengineGroupId
.If a
FlutterEngineGroup
is null, thatFlutterEngineGroup
is removed from this cache.
-
remove
public void remove(@NonNull String engineGroupId)
Removes anyFlutterEngineGroup
that is currently in the cache that is identified by the givenengineGroupId
.
-
clear
public void clear()
Removes allFlutterEngineGroup
's that are currently in the cache.
-
-