Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Package Functions | List of all members
io.flutter.embedding.engine.FlutterEngineGroupCache Class Reference

Public Member Functions

boolean contains (@NonNull String engineGroupId)
 
FlutterEngineGroup get (@NonNull String engineGroupId)
 
void put (@NonNull String engineGroupId, @Nullable FlutterEngineGroup engineGroup)
 
void remove (@NonNull String engineGroupId)
 
void clear ()
 

Static Public Member Functions

static FlutterEngineGroupCache getInstance ()
 

Package Functions

 FlutterEngineGroupCache ()
 

Detailed Description

Static singleton cache that holds io.flutter.embedding.engine.FlutterEngineGroup instances identified by Strings.

The ID of a given io.flutter.embedding.engine.FlutterEngineGroup can be whatever String is desired.

io.flutter.embedding.android.FlutterActivity and io.flutter.embedding.android.FlutterFragment use the FlutterEngineGroupCache singleton internally when instructed to use a cached io.flutter.embedding.engine.FlutterEngineGroup based on a given ID. See io.flutter.embedding.android.FlutterActivity.NewEngineInGroupIntentBuilder and io.flutter.embedding.android.FlutterFragment#withNewEngineInGroup(String) for related APIs.

Definition at line 27 of file FlutterEngineGroupCache.java.

Constructor & Destructor Documentation

◆ FlutterEngineGroupCache()

io.flutter.embedding.engine.FlutterEngineGroupCache.FlutterEngineGroupCache ( )
inlinepackage

Definition at line 50 of file FlutterEngineGroupCache.java.

50{}

Member Function Documentation

◆ clear()

void io.flutter.embedding.engine.FlutterEngineGroupCache.clear ( )
inline

Removes all io.flutter.embedding.engine.FlutterEngineGroup's that are currently in the cache.

Definition at line 97 of file FlutterEngineGroupCache.java.

97 {
98 cachedEngineGroups.clear();
99 }

◆ contains()

boolean io.flutter.embedding.engine.FlutterEngineGroupCache.contains ( @NonNull String  engineGroupId)
inline

Returns true if a io.flutter.embedding.engine.FlutterEngineGroup in this cache is associated with the given engineGroupId.

Definition at line 56 of file FlutterEngineGroupCache.java.

56 {
57 return cachedEngineGroups.containsKey(engineGroupId);
58 }

◆ get()

FlutterEngineGroup io.flutter.embedding.engine.FlutterEngineGroupCache.get ( @NonNull String  engineGroupId)
inline

Returns the io.flutter.embedding.engine.FlutterEngineGroup in this cache that is associated with the given engineGroupId, or null is no such io.flutter.embedding.engine.FlutterEngineGroup exists.

Definition at line 66 of file FlutterEngineGroupCache.java.

66 {
67 return cachedEngineGroups.get(engineGroupId);
68 }

◆ getInstance()

static FlutterEngineGroupCache io.flutter.embedding.engine.FlutterEngineGroupCache.getInstance ( )
inlinestatic

Returns the static singleton instance of FlutterEngineGroupCache.

Creates a new instance if one does not yet exist.

Definition at line 36 of file FlutterEngineGroupCache.java.

36 {
37 if (instance == null) {
38 synchronized (FlutterEngineGroupCache.class) {
39 if (instance == null) {
40 instance = new FlutterEngineGroupCache();
41 }
42 }
43 }
44 return instance;
45 }

◆ put()

void io.flutter.embedding.engine.FlutterEngineGroupCache.put ( @NonNull String  engineGroupId,
@Nullable FlutterEngineGroup  engineGroup 
)
inline

Places the given io.flutter.embedding.engine.FlutterEngineGroup in this cache and associates it with the given engineGroupId.

If a io.flutter.embedding.engine.FlutterEngineGroup is null, that io.flutter.embedding.engine.FlutterEngineGroup is removed from this cache.

Definition at line 77 of file FlutterEngineGroupCache.java.

77 {
78 if (engineGroup != null) {
79 cachedEngineGroups.put(engineGroupId, engineGroup);
80 } else {
81 cachedEngineGroups.remove(engineGroupId);
82 }
83 }

◆ remove()

void io.flutter.embedding.engine.FlutterEngineGroupCache.remove ( @NonNull String  engineGroupId)
inline

Removes any io.flutter.embedding.engine.FlutterEngineGroup that is currently in the cache that is identified by the given engineGroupId.

Definition at line 89 of file FlutterEngineGroupCache.java.

89 {
90 put(engineGroupId, null);
91 }
void put(@NonNull String engineGroupId, @Nullable FlutterEngineGroup engineGroup)

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