lazyPut<T> method

void lazyPut<T>(
  1. _LazyBuilderCallback<T> builder, {
  2. String? tag,
  3. bool autoRemove = false,
  4. _RemoveCallback<T>? onRemove,
})

Creates a new Instance lazily from the <S>builder() callback.

autoRemove set this value to true when you want to remove this dependency when the route who creates this dependency is popped

onRemove callback to be called when this dependency is removed

Implementation

void lazyPut<T>(
  _LazyBuilderCallback<T> builder, {
  String? tag,
  bool autoRemove = false,
  _RemoveCallback<T>? onRemove,
}) {
  final key = _getKey(T, tag);
  _lazyVars.putIfAbsent(
    key,
    () => _Lazy<T>(
      builder,
      autoRemove: autoRemove,
      onRemove: onRemove,
    ),
  );
}