docs(faq): add best practice FAQ about using await with scope disposal

- Added FAQ section in documentation (README and tutorials, EN + RU) recommending always using await when calling CherryPick.closeRootScope, scope.closeScope, or scope.dispose, even if no services implement Disposable.
- Clarifies future-proof resource management for all users.
This commit is contained in:
Sergey Penkovsky
2025-08-04 10:47:33 +03:00
parent 547a15fa4e
commit a4b0ddfa54
3 changed files with 3 additions and 3 deletions

View File

@@ -465,7 +465,7 @@ You can use CherryPick in Dart CLI, server apps, and microservices. All major fe
## FAQ
### Q: Do I need to use `await` with CherryPick.closeRootScope(), scope.closeScope(), or scope.dispose() if I have no Disposable services?
### Q: Do I need to use `await` with CherryPick.closeRootScope(), CherryPick.closeScope(), or scope.dispose() if I have no Disposable services?
**A:**
Yes! Even if none of your services currently implement `Disposable`, always use `await` when closing scopes. If you later add resource cleanup (by implementing `dispose()`), CherryPick will handle it automatically without you needing to change your scope cleanup code. This ensures resource management is future-proof, robust, and covers all application scenarios.