Showing
1 changed file
with
20 additions
and
27 deletions
@@ -162,30 +162,23 @@ class GetInstance { | @@ -162,30 +162,23 @@ class GetInstance { | ||
162 | }) { | 162 | }) { |
163 | final key = _getKey(S, name); | 163 | final key = _getKey(S, name); |
164 | 164 | ||
165 | + _InstanceBuilderFactory<S>? dep; | ||
165 | if (_singl.containsKey(key)) { | 166 | if (_singl.containsKey(key)) { |
166 | - final dep = _singl[key]; | ||
167 | - if (dep != null && dep.isDirty) { | ||
168 | - _singl[key] = _InstanceBuilderFactory<S>( | ||
169 | - isSingleton, | ||
170 | - builder, | ||
171 | - permanent, | ||
172 | - false, | ||
173 | - fenix, | ||
174 | - name, | ||
175 | - lateRemove: dep as _InstanceBuilderFactory<S>, | ||
176 | - ); | 167 | + final _dep = _singl[key]; |
168 | + if (_dep != null && _dep.isDirty) { | ||
169 | + dep = _dep as _InstanceBuilderFactory<S>; | ||
170 | + } | ||
177 | } | 171 | } |
178 | - } else { | ||
179 | _singl[key] = _InstanceBuilderFactory<S>( | 172 | _singl[key] = _InstanceBuilderFactory<S>( |
180 | - isSingleton, | ||
181 | - builder, | ||
182 | - permanent, | ||
183 | - false, | ||
184 | - fenix, | ||
185 | - name, | 173 | + isSingleton: isSingleton, |
174 | + builderFunc: builder, | ||
175 | + permanent: permanent, | ||
176 | + isInit: false, | ||
177 | + fenix: fenix, | ||
178 | + tag: name, | ||
179 | + lateRemove: dep, | ||
186 | ); | 180 | ); |
187 | } | 181 | } |
188 | - } | ||
189 | 182 | ||
190 | /// Initializes the dependencies for a Class Instance [S] (or tag), | 183 | /// Initializes the dependencies for a Class Instance [S] (or tag), |
191 | /// If its a Controller, it starts the lifecycle process. | 184 | /// If its a Controller, it starts the lifecycle process. |
@@ -518,14 +511,14 @@ class _InstanceBuilderFactory<S> { | @@ -518,14 +511,14 @@ class _InstanceBuilderFactory<S> { | ||
518 | 511 | ||
519 | String? tag; | 512 | String? tag; |
520 | 513 | ||
521 | - _InstanceBuilderFactory( | ||
522 | - this.isSingleton, | ||
523 | - this.builderFunc, | ||
524 | - this.permanent, | ||
525 | - this.isInit, | ||
526 | - this.fenix, | ||
527 | - this.tag, { | ||
528 | - this.lateRemove, | 514 | + _InstanceBuilderFactory({ |
515 | + required this.isSingleton, | ||
516 | + required this.builderFunc, | ||
517 | + required this.permanent, | ||
518 | + required this.isInit, | ||
519 | + required this.fenix, | ||
520 | + required this.tag, | ||
521 | + required this.lateRemove, | ||
529 | }); | 522 | }); |
530 | 523 | ||
531 | void _showInitLog() { | 524 | void _showInitLog() { |
-
Please register or login to post a comment