Package io.flutter.embedding.engine

# Class FlutterEngineGroupCache

java.lang.Object
io.flutter.embedding.engine.FlutterEngineGroupCache

public class FlutterEngineGroupCache extends Object
Static singleton cache that holds `FlutterEngineGroup` instances identified by `String`s.

The ID of a given `FlutterEngineGroup` can be whatever `String` is desired.

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Removes all `FlutterEngineGroup`'s that are currently in the cache.
  `boolean`
  `contains(String engineGroupId)`
  Returns `true` if a `FlutterEngineGroup` in this cache is associated with the given `engineGroupId`.
  `FlutterEngineGroup`
  `get(String engineGroupId)`
  Returns the `FlutterEngineGroup` in this cache that is associated with the given `engineGroupId`, or `null` is no such `FlutterEngineGroup` exists.
  `static FlutterEngineGroupCache`
  `getInstance()`
  Returns the static singleton instance of `FlutterEngineGroupCache`.
  `void`
  `put(String engineGroupId, FlutterEngineGroup engineGroup)`
  Places the given `FlutterEngineGroup` in this cache and associates it with the given `engineGroupId`.
  `void`
  `remove(String engineGroupId)`
  Removes any `FlutterEngineGroup` that is currently in the cache that is identified by the given `engineGroupId`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getInstance

    @NonNull public static FlutterEngineGroupCache getInstance()
    Returns the static singleton instance of `FlutterEngineGroupCache`.

    Creates a new instance if one does not yet exist.

  - ### contains

    public boolean contains(@NonNull String engineGroupId)
    Returns `true` if a `FlutterEngineGroup` in this cache is associated with the given `engineGroupId`.

  - ### get

    @Nullable public FlutterEngineGroup get(@NonNull String engineGroupId)
    Returns the `FlutterEngineGroup` in this cache that is associated with the given `engineGroupId`, or `null` is no such `FlutterEngineGroup` exists.

  - ### put

    public void put(@NonNull String engineGroupId, @Nullable FlutterEngineGroup engineGroup)
    Places the given `FlutterEngineGroup` in this cache and associates it with the given `engineGroupId`.

    If a `FlutterEngineGroup` is null, that `FlutterEngineGroup` is removed from this cache.

  - ### remove

    public void remove(@NonNull String engineGroupId)
    Removes any `FlutterEngineGroup` that is currently in the cache that is identified by the given `engineGroupId`.

  - ### clear

    public void clear()
    Removes all `FlutterEngineGroup`'s that are currently in the cache.