mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 05:25:19 +00:00
refactor(scope): simplify _findBindingResolver<T> with one-liner and optional chaining
The function is now shorter, more readable and uses modern Dart null-safety idioms. No functional change.
This commit is contained in:
@@ -258,11 +258,8 @@ class Scope with CycleDetectionMixin, GlobalCycleDetectionMixin {
|
|||||||
_parentScope?.tryResolveAsync(named: named, params: params);
|
_parentScope?.tryResolveAsync(named: named, params: params);
|
||||||
}
|
}
|
||||||
|
|
||||||
BindingResolver<T>? _findBindingResolver<T>(String? named) {
|
BindingResolver<T>? _findBindingResolver<T>(String? named) =>
|
||||||
final byType = _bindingResolvers[T];
|
_bindingResolvers[T]?[named] as BindingResolver<T>?;
|
||||||
if (byType == null) return null;
|
|
||||||
return byType[named] as BindingResolver<T>?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Индексируем все binding’и после каждого installModules/dropModules
|
// Индексируем все binding’и после каждого installModules/dropModules
|
||||||
void _rebuildResolversIndex() {
|
void _rebuildResolversIndex() {
|
||||||
|
|||||||
Reference in New Issue
Block a user