put<T> method

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

Insert an Instance into the hashmap

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 put<T>(
  T value, {
  String? tag,
  bool autoRemove = false,
  _RemoveCallback<T>? onRemove,
}) {
  final key = _getKey(T, tag);
  _vars[key] = Singleton<T>(
    value,
    autoRemove: autoRemove,
    onRemove: onRemove,
  );
}