getBind<T extends Object> method

  1. @override
BindEntry<T>? getBind<T extends Object>(
  1. Injector injector
)
inherited

Get the binds for that context.

Implementation

@override
BindEntry<T>? getBind<T extends Object>(Injector injector) {
  T bindValue;
  var type = _getInjectType<T>();
  if (_singletonBinds.containsKey(type)) {
    return _singletonBinds[type]!.cast<T>();
  }

  var bind = getProcessBinds().firstWhere(
      (b) => b.factoryFunction is T Function(Injector),
      orElse: () => BindEmpty());
  if (bind is BindEmpty) {
    return null;
  }

  bindValue = bind.factoryFunction(injector) as T;
  final entry = BindEntry<T>(value: bindValue, bind: bind.cast<T>());
  if (bind.isSingleton) {
    _singletonBinds[type] = entry;
  }

  return entry;
}