Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Package Functions | List of all members
io.flutter.embedding.engine.FlutterEngineCache Class Reference

Public Member Functions

boolean contains (@NonNull String engineId)
 
FlutterEngine get (@NonNull String engineId)
 
void put (@NonNull String engineId, @Nullable FlutterEngine engine)
 
void remove (@NonNull String engineId)
 
void clear ()
 

Static Public Member Functions

static FlutterEngineCache getInstance ()
 

Package Functions

 FlutterEngineCache ()
 

Detailed Description

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

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

FlutterEngineCache is useful for storing pre-warmed io.flutter.embedding.engine.FlutterEngine instances. io.flutter.embedding.android.FlutterActivity and io.flutter.embedding.android.FlutterFragment use the FlutterEngineCache singleton internally when instructed to use a cached io.flutter.embedding.engine.FlutterEngine based on a given ID. See io.flutter.embedding.android.FlutterActivity.CachedEngineIntentBuilder and io.flutter.embedding.android.FlutterFragment#withCachedEngine(String) for related APIs.

Definition at line 29 of file FlutterEngineCache.java.

Constructor & Destructor Documentation

◆ FlutterEngineCache()

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

Definition at line 48 of file FlutterEngineCache.java.

48{}

Member Function Documentation

◆ clear()

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

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

Definition at line 96 of file FlutterEngineCache.java.

96 {
97 cachedEngines.clear();
98 }

◆ contains()

boolean io.flutter.embedding.engine.FlutterEngineCache.contains ( @NonNull String  engineId)
inline

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

Definition at line 54 of file FlutterEngineCache.java.

54 {
55 return cachedEngines.containsKey(engineId);
56 }

◆ get()

FlutterEngine io.flutter.embedding.engine.FlutterEngineCache.get ( @NonNull String  engineId)
inline

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

Definition at line 64 of file FlutterEngineCache.java.

64 {
65 return cachedEngines.get(engineId);
66 }

◆ getInstance()

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

Returns the static singleton instance of FlutterEngineCache.

Creates a new instance if one does not yet exist.

Definition at line 38 of file FlutterEngineCache.java.

38 {
39 if (instance == null) {
40 instance = new FlutterEngineCache();
41 }
42 return instance;
43 }

◆ put()

void io.flutter.embedding.engine.FlutterEngineCache.put ( @NonNull String  engineId,
@Nullable FlutterEngine  engine 
)
inline

Places the given io.flutter.embedding.engine.FlutterEngine in this cache and associates it with the given engineId.

If a io.flutter.embedding.engine.FlutterEngine already exists in this cache for the given engineId, that io.flutter.embedding.engine.FlutterEngine is removed from this cache.

Definition at line 76 of file FlutterEngineCache.java.

76 {
77 if (engine != null) {
78 cachedEngines.put(engineId, engine);
79 } else {
80 cachedEngines.remove(engineId);
81 }
82 }

◆ remove()

void io.flutter.embedding.engine.FlutterEngineCache.remove ( @NonNull String  engineId)
inline

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

Definition at line 88 of file FlutterEngineCache.java.

88 {
89 put(engineId, null);
90 }
void put(@NonNull String engineId, @Nullable FlutterEngine engine)

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