attachByKey method

dynamic attachByKey(
  1. String key,
  2. TouchRippleEffect effect
)

Delegates the task of adding a touch ripple effect to this controller to ensure it can be reliably detached and disposed late by a given key.

Implementation

attachByKey(String key, TouchRippleEffect effect) {
  assert(!_stateMap.containsKey(key), "Already exists a given ripple effect");
  _stateMap[key] = effect
    ..addListener(notifyListeners)
    ..onDispose = () => detachByKey(key);
}