Showing
4 changed files
with
10 additions
and
5 deletions
| @@ -285,6 +285,7 @@ class GetInstance { | @@ -285,6 +285,7 @@ class GetInstance { | ||
| 285 | 285 | ||
| 286 | /// Clears all registered instances (and/or tags). | 286 | /// Clears all registered instances (and/or tags). |
| 287 | /// Even the persistent ones. | 287 | /// Even the persistent ones. |
| 288 | + /// This should be used at the end or tearDown of unit tests. | ||
| 288 | /// | 289 | /// |
| 289 | /// [clearFactory] clears the callbacks registered by [lazyPut] | 290 | /// [clearFactory] clears the callbacks registered by [lazyPut] |
| 290 | /// [clearRouteBindings] clears Instances associated with routes. | 291 | /// [clearRouteBindings] clears Instances associated with routes. |
| @@ -293,9 +294,10 @@ class GetInstance { | @@ -293,9 +294,10 @@ class GetInstance { | ||
| 293 | {@deprecated bool clearFactory = true, | 294 | {@deprecated bool clearFactory = true, |
| 294 | @deprecated bool clearRouteBindings = true}) { | 295 | @deprecated bool clearRouteBindings = true}) { |
| 295 | // if (clearFactory) _factory.clear(); | 296 | // if (clearFactory) _factory.clear(); |
| 296 | - deleteAll(force: true); | ||
| 297 | - // if (clearRouteBindings) clearRouteKeys(); | ||
| 298 | - // _singl.clear(); | 297 | + // deleteAll(force: true); |
| 298 | + if (clearRouteBindings) RouterReportManager.clearRouteKeys(); | ||
| 299 | + _singl.clear(); | ||
| 300 | + | ||
| 299 | return true; | 301 | return true; |
| 300 | } | 302 | } |
| 301 | 303 |
| @@ -32,7 +32,7 @@ class RouterReportManager<T> { | @@ -32,7 +32,7 @@ class RouterReportManager<T> { | ||
| 32 | _routesKey.putIfAbsent(depedencyKey, () => _current); | 32 | _routesKey.putIfAbsent(depedencyKey, () => _current); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | - void clearRouteKeys() { | 35 | + static void clearRouteKeys() { |
| 36 | _routesKey.clear(); | 36 | _routesKey.clear(); |
| 37 | } | 37 | } |
| 38 | 38 |
| 1 | name: get | 1 | name: get |
| 2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. | 2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. |
| 3 | -version: 4.3.2 | 3 | +version: 4.3.3 |
| 4 | homepage: https://github.com/jonataslaw/getx | 4 | homepage: https://github.com/jonataslaw/getx |
| 5 | 5 | ||
| 6 | environment: | 6 | environment: |
-
Please register or login to post a comment