mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
Compare commits
32 Commits
cherrypick
...
talker_che
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99e662124f | ||
|
|
03f54981f3 | ||
|
|
349efe6ba6 | ||
|
|
c2f0e027b6 | ||
|
|
f85036d20f | ||
|
|
db4d128d04 | ||
|
|
2c4e2ed251 | ||
|
|
7b4642f407 | ||
|
|
7d45d00d6a | ||
|
|
884df50a34 | ||
|
|
5710af2f9b | ||
|
|
9312ef46ea | ||
|
|
900cd68663 | ||
|
|
57e4196b95 | ||
|
|
358da8f96b | ||
|
|
ea2b6687f4 | ||
|
|
df00a2a5d2 | ||
|
|
d5983a4a0b | ||
|
|
125bccfa5a | ||
|
|
12b97c9368 | ||
|
|
424aaa3e22 | ||
|
|
2ec3a86a2f | ||
|
|
efed72cc39 | ||
|
|
4dc9e269cd | ||
|
|
d153ab4255 | ||
|
|
6924ccd07b | ||
|
|
26b843f791 | ||
|
|
8eafba4e4b | ||
|
|
ad6e9bbc3d | ||
|
|
bea8affcab | ||
|
|
1d7b9a9166 | ||
|
|
016c212063 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -18,5 +18,7 @@ pubspec_overrides.yaml
|
||||
melos_cherrypick.iml
|
||||
melos_cherrypick_workspace.iml
|
||||
melos_cherrypick_flutter.iml
|
||||
melos_benchmark_di.iml
|
||||
melos_talker_cherrypick_logger.iml
|
||||
|
||||
coverage
|
||||
118
CHANGELOG.md
118
CHANGELOG.md
@@ -3,6 +3,124 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2025-08-13
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`talker_cherrypick_logger` - `v1.1.0-dev.3`](#talker_cherrypick_logger---v110-dev3)
|
||||
|
||||
---
|
||||
|
||||
#### `talker_cherrypick_logger` - `v1.1.0-dev.3`
|
||||
|
||||
|
||||
## 2025-08-13
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`talker_cherrypick_logger` - `v1.1.0-dev.2`](#talker_cherrypick_logger---v110-dev2)
|
||||
|
||||
---
|
||||
|
||||
#### `talker_cherrypick_logger` - `v1.1.0-dev.2`
|
||||
|
||||
- Bump "talker_cherrypick_logger" to `1.1.0-dev.2`.
|
||||
|
||||
|
||||
## 2025-08-13
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- [`cherrypick_generator` - `v2.0.0-dev.0`](#cherrypick_generator---v200-dev0)
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`cherrypick` - `v3.0.0-dev.9`](#cherrypick---v300-dev9)
|
||||
- [`cherrypick_annotations` - `v1.1.2-dev.0`](#cherrypick_annotations---v112-dev0)
|
||||
- [`cherrypick_flutter` - `v1.1.3-dev.9`](#cherrypick_flutter---v113-dev9)
|
||||
- [`talker_cherrypick_logger` - `v1.1.0-dev.0`](#talker_cherrypick_logger---v110-dev0)
|
||||
|
||||
---
|
||||
|
||||
#### `cherrypick_generator` - `v2.0.0-dev.0`
|
||||
|
||||
- **BREAKING** **DOCS**(generator): improve and unify English documentation and examples for all DI source files.
|
||||
|
||||
#### `cherrypick` - `v3.0.0-dev.9`
|
||||
|
||||
- **DOCS**(readme): add talker_cherrypick_logger to Additional Modules section.
|
||||
- **DOCS**(api): improve all DI core code documentation with English dartdoc and examples.
|
||||
|
||||
#### `cherrypick_annotations` - `v1.1.2-dev.0`
|
||||
|
||||
- **DOCS**(annotations): unify and improve English DartDoc for all DI annotations.
|
||||
|
||||
#### `cherrypick_flutter` - `v1.1.3-dev.9`
|
||||
|
||||
- **DOCS**(provider): add detailed English API documentation for CherryPickProvider Flutter integration.
|
||||
|
||||
#### `talker_cherrypick_logger` - `v1.1.0-dev.0`
|
||||
|
||||
- **FEAT**(logging): add talker_dio_logger and talker_bloc_logger integration, improve cherrypick logger structure, add UI log screen for DI and network/bloc debug.
|
||||
- **DOCS**: add full English documentation and usage guide to README.md.
|
||||
- **DOCS**: add detailed English documentation and usage examples for TalkerCherryPickObserver.
|
||||
|
||||
|
||||
## 2025-08-12
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`cherrypick` - `v3.0.0-dev.8`](#cherrypick---v300-dev8)
|
||||
- [`cherrypick_flutter` - `v1.1.3-dev.8`](#cherrypick_flutter---v113-dev8)
|
||||
|
||||
Packages with dependency updates only:
|
||||
|
||||
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
|
||||
|
||||
- `cherrypick_flutter` - `v1.1.3-dev.8`
|
||||
|
||||
---
|
||||
|
||||
#### `cherrypick` - `v3.0.0-dev.8`
|
||||
|
||||
- **REFACTOR**(tests): replace MockLogger with MockObserver in scope tests to align with updated observer API.
|
||||
- **FIX**(doc): remove hide symbol.
|
||||
- **FEAT**(core): add full DI lifecycle observability via onInstanceDisposed.
|
||||
- **DOCS**(logging): update Logging section in README with modern Observer usage and Talker integration examples.
|
||||
- **DOCS**(observer): improve documentation, translate all comments to English, add usage examples.
|
||||
- **DOCS**(README): add section with overview table for additional modules.
|
||||
- **DOCS**(README): refactor structure and improve clarity of advanced features.
|
||||
- **DOCS**(README): add 'Hierarchical Subscopes' section and update structure for advanced features clarity.
|
||||
|
||||
|
||||
## 2025-08-11
|
||||
|
||||
### Changes
|
||||
|
||||
@@ -47,7 +47,7 @@ packages:
|
||||
path: "../cherrypick"
|
||||
relative: true
|
||||
source: path
|
||||
version: "3.0.0-dev.5"
|
||||
version: "3.0.0-dev.8"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
## 3.0.0-dev.9
|
||||
|
||||
- **DOCS**(readme): add talker_cherrypick_logger to Additional Modules section.
|
||||
- **DOCS**(api): improve all DI core code documentation with English dartdoc and examples.
|
||||
|
||||
## 3.0.0-dev.8
|
||||
|
||||
- **REFACTOR**(tests): replace MockLogger with MockObserver in scope tests to align with updated observer API.
|
||||
- **FIX**(doc): remove hide symbol.
|
||||
- **FEAT**(core): add full DI lifecycle observability via onInstanceDisposed.
|
||||
- **DOCS**(logging): update Logging section in README with modern Observer usage and Talker integration examples.
|
||||
- **DOCS**(observer): improve documentation, translate all comments to English, add usage examples.
|
||||
- **DOCS**(README): add section with overview table for additional modules.
|
||||
- **DOCS**(README): refactor structure and improve clarity of advanced features.
|
||||
- **DOCS**(README): add 'Hierarchical Subscopes' section and update structure for advanced features clarity.
|
||||
|
||||
## 3.0.0-dev.7
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
@@ -13,7 +13,7 @@ It provides an easy-to-use system for registering, scoping, and resolving depend
|
||||
- [Binding](#binding)
|
||||
- [Module](#module)
|
||||
- [Scope](#scope)
|
||||
- [Automatic Resource Cleanup with Disposable](#automatic-resource-cleanup-with-disposable)
|
||||
- [Disposable](#disposable)
|
||||
- [Dependency Resolution API](#dependency-resolution-api)
|
||||
- [Using Annotations & Code Generation](#using-annotations--code-generation)
|
||||
- [Advanced Features](#advanced-features)
|
||||
@@ -24,6 +24,7 @@ It provides an easy-to-use system for registering, scoping, and resolving depend
|
||||
- [Example Application](#example-application)
|
||||
- [FAQ](#faq)
|
||||
- [Documentation Links](#documentation-links)
|
||||
- [Additional Modules](#additional-modules)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
|
||||
@@ -50,13 +51,14 @@ Add to your `pubspec.yaml`:
|
||||
```yaml
|
||||
dependencies:
|
||||
cherrypick: ^<latest_version>
|
||||
```
|
||||
````
|
||||
|
||||
Then run:
|
||||
|
||||
```shell
|
||||
dart pub get
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
@@ -66,7 +68,6 @@ Here is a minimal example that registers and resolves a dependency:
|
||||
```dart
|
||||
import 'package:cherrypick/cherrypick.dart';
|
||||
|
||||
|
||||
class AppModule extends Module {
|
||||
@override
|
||||
void builder(Scope currentScope) {
|
||||
@@ -92,11 +93,11 @@ await CherryPick.closeRootScope();
|
||||
|
||||
A **Binding** acts as a configuration for how to create or provide a particular dependency. Bindings support:
|
||||
|
||||
- Direct instance assignment (`toInstance()`, `toInstanceAsync()`)
|
||||
- Lazy providers (sync/async functions)
|
||||
- Provider functions supporting dynamic parameters
|
||||
- Named instances for resolving by string key
|
||||
- Optional singleton lifecycle
|
||||
* Direct instance assignment (`toInstance()`, `toInstanceAsync()`)
|
||||
* Lazy providers (sync/async functions)
|
||||
* Provider functions supporting dynamic parameters
|
||||
* Named instances for resolving by string key
|
||||
* Optional singleton lifecycle
|
||||
|
||||
#### Example
|
||||
|
||||
@@ -172,7 +173,7 @@ await CherryPick.closeRootScope();
|
||||
|
||||
---
|
||||
|
||||
### Automatic Resource Cleanup with Disposable
|
||||
### Disposable
|
||||
|
||||
CherryPick can automatically clean up any dependency that implements the `Disposable` interface. This makes resource management (for controllers, streams, sockets, files, etc.) easy and reliable—especially when scopes or the app are shut down.
|
||||
|
||||
@@ -223,67 +224,17 @@ await CherryPick.closeRootScope(); // awaits async disposal
|
||||
|
||||
---
|
||||
|
||||
### Automatic resource management (`Disposable`, `dispose`)
|
||||
## Dependency Resolution API
|
||||
|
||||
CherryPick automatically manages the lifecycle of any object registered via DI that implements the `Disposable` interface.
|
||||
- `resolve<T>()` — Locates a dependency instance or throws if missing.
|
||||
- `resolveAsync<T>()` — Async variant for dependencies requiring async binding.
|
||||
- `tryResolve<T>()` — Returns `null` if not found (sync).
|
||||
- `tryResolveAsync<T>()` — Returns `null` async if not found.
|
||||
|
||||
**Best practice:**
|
||||
Always finish your work with `await CherryPick.closeRootScope()` (for the root scope) or `await scope.closeSubScope('key')` (for subscopes).
|
||||
These methods will automatically await `dispose()` on all resolved objects (e.g., singletons) that implement `Disposable`, ensuring proper and complete resource cleanup—sync or async.
|
||||
|
||||
Manual `await scope.dispose()` may be useful if you manually manage custom scopes.
|
||||
|
||||
#### Example
|
||||
|
||||
```dart
|
||||
class MyService implements Disposable {
|
||||
@override
|
||||
FutureOr<void> dispose() async {
|
||||
// release resources, close streams, perform async shutdown, etc.
|
||||
print('MyService disposed!');
|
||||
}
|
||||
}
|
||||
|
||||
final scope = openRootScope();
|
||||
scope.installModules([
|
||||
ModuleImpl(),
|
||||
]);
|
||||
|
||||
final service = scope.resolve<MyService>();
|
||||
|
||||
// ... use service
|
||||
|
||||
// Recommended completion:
|
||||
await CherryPick.closeRootScope(); // will print: MyService disposed!
|
||||
|
||||
// Or, to close and clean up a subscope and its resources:
|
||||
await scope.closeSubScope('feature');
|
||||
|
||||
class ModuleImpl extends Module {
|
||||
@override
|
||||
void builder(Scope scope) {
|
||||
bind<MyService>().toProvide(() => MyService()).singleton();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Working with Subscopes
|
||||
|
||||
```dart
|
||||
// Open a named child scope (e.g., for a feature/module)
|
||||
final subScope = rootScope.openSubScope('featureScope')
|
||||
..installModules([FeatureModule()]);
|
||||
|
||||
// Resolve from subScope, with fallback to parents if missing
|
||||
final dataBloc = await subScope.resolveAsync<DataBloc>();
|
||||
```
|
||||
|
||||
### Fast Dependency Lookup (Performance Improvement)
|
||||
|
||||
> **Performance Note:**
|
||||
> **Starting from version 3.0.0**, CherryPick uses a Map-based resolver index for dependency lookup. This means calls to `resolve<T>()` and related methods are now O(1) operations, regardless of the number of modules or bindings in your scope. Previously, the library had to iterate over all modules and bindings to locate the requested dependency, which could impact performance as your project grew.
|
||||
>
|
||||
> This optimization is internal and does not change any library APIs or usage patterns, but it significantly improves resolution speed in larger applications.
|
||||
Supports:
|
||||
- Synchronous and asynchronous dependencies
|
||||
- Named dependencies
|
||||
- Provider functions with and without runtime parameters
|
||||
|
||||
---
|
||||
|
||||
@@ -337,7 +288,7 @@ class ProfilePage with _\$ProfilePage {
|
||||
}
|
||||
```
|
||||
|
||||
- After running build_runner, the mixin `_ | ||||