putOrFind<T extends FxController> static method

T putOrFind<T extends FxController>(
  1. T controller, {
  2. String? tag,
  3. bool save = true,
})

Implementation

static T putOrFind<T extends FxController>(T controller,
    {String? tag, bool save = true}) {
  tag ??= controller.getTag();
  _history.add(tag);
  if (_controllers.containsKey(tag) && _controllers[tag] is T) {
    T controller = _controllers[tag] as T;
    controller.save = controller.save && save;
    return controller;
  }
  return put(controller, tag: tag, save: save);
}