mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
Compare commits
9 Commits
talker_che
...
talker_che
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ef12e990f | ||
|
|
5c57370755 | ||
|
|
8711dc83d0 | ||
|
|
043737e2c9 | ||
|
|
ed65e3c23d | ||
|
|
a897c1b31b | ||
|
|
dd9c3faa62 | ||
|
|
a4c5fd922e | ||
|
|
8870b8ce54 |
103
CHANGELOG.md
103
CHANGELOG.md
@@ -3,6 +3,109 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2025-08-19
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`cherrypick` - `v3.0.0-dev.12`](#cherrypick---v300-dev12)
|
||||
- [`cherrypick_flutter` - `v1.1.3-dev.12`](#cherrypick_flutter---v113-dev12)
|
||||
- [`talker_cherrypick_logger` - `v1.1.0-dev.7`](#talker_cherrypick_logger---v110-dev7)
|
||||
|
||||
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.12`
|
||||
- `talker_cherrypick_logger` - `v1.1.0-dev.7`
|
||||
|
||||
---
|
||||
|
||||
#### `cherrypick` - `v3.0.0-dev.12`
|
||||
|
||||
- **FIX**(scope): prevent concurrent modification in dispose().
|
||||
- **FIX**(binding): fix unterminated string literal and syntax issues in binding.dart.
|
||||
|
||||
|
||||
## 2025-08-19
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`cherrypick` - `v3.0.0-dev.11`](#cherrypick---v300-dev11)
|
||||
- [`cherrypick_flutter` - `v1.1.3-dev.11`](#cherrypick_flutter---v113-dev11)
|
||||
- [`talker_cherrypick_logger` - `v1.1.0-dev.6`](#talker_cherrypick_logger---v110-dev6)
|
||||
|
||||
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.11`
|
||||
- `talker_cherrypick_logger` - `v1.1.0-dev.6`
|
||||
|
||||
---
|
||||
|
||||
#### `cherrypick` - `v3.0.0-dev.11`
|
||||
|
||||
- **FIX**(scope): prevent concurrent modification in dispose().
|
||||
- **FIX**(binding): fix unterminated string literal and syntax issues in binding.dart.
|
||||
|
||||
|
||||
## 2025-08-15
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`cherrypick` - `v3.0.0-dev.10`](#cherrypick---v300-dev10)
|
||||
- [`cherrypick_annotations` - `v1.1.2-dev.1`](#cherrypick_annotations---v112-dev1)
|
||||
- [`cherrypick_flutter` - `v1.1.3-dev.10`](#cherrypick_flutter---v113-dev10)
|
||||
- [`cherrypick_generator` - `v2.0.0-dev.1`](#cherrypick_generator---v200-dev1)
|
||||
- [`talker_cherrypick_logger` - `v1.1.0-dev.5`](#talker_cherrypick_logger---v110-dev5)
|
||||
|
||||
---
|
||||
|
||||
#### `cherrypick` - `v3.0.0-dev.10`
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
#### `cherrypick_annotations` - `v1.1.2-dev.1`
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
#### `cherrypick_flutter` - `v1.1.3-dev.10`
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
#### `cherrypick_generator` - `v2.0.0-dev.1`
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
#### `talker_cherrypick_logger` - `v1.1.0-dev.5`
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
|
||||
## 2025-08-13
|
||||
|
||||
### Changes
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
# Comparative DI Benchmark Report: cherrypick vs get_it vs riverpod
|
||||
# Comparative DI Benchmark Report: cherrypick vs get_it vs riverpod vs kiwi
|
||||
|
||||
## Benchmark Parameters
|
||||
|
||||
- chainCount = 100
|
||||
- nestingDepth = 100
|
||||
- repeat = 5
|
||||
- warmup = 2
|
||||
|
||||
## Benchmark Scenarios
|
||||
|
||||
@@ -11,41 +18,33 @@
|
||||
|
||||
---
|
||||
|
||||
## Comparative Table: chainCount=10, nestingDepth=10 (Mean, PeakRSS)
|
||||
## Comparative Table: chainCount=100, nestingDepth=100, repeat=5, warmup=2 (Mean time, µs)
|
||||
|
||||
| Scenario | cherrypick Mean (us) | cherrypick PeakRSS | get_it Mean (us) | get_it PeakRSS | riverpod Mean (us) | riverpod PeakRSS |
|
||||
|--------------------|---------------------:|-------------------:|-----------------:|---------------:|-------------------:|-----------------:|
|
||||
| RegisterSingleton | 13.00 | 273104 | 8.40 | 261872 | 9.80 | 268512 |
|
||||
| ChainSingleton | 13.80 | 271072 | 2.00 | 262000 | 33.60 | 268784 |
|
||||
| ChainFactory | 5.00 | 299216 | 4.00 | 297136 | 22.80 | 271296 |
|
||||
| AsyncChain | 28.60 | 290640 | 24.60 | 342976 | 78.20 | 285920 |
|
||||
| Named | 2.20 | 297008 | 0.20 | 449824 | 6.20 | 281136 |
|
||||
| Override | 7.00 | 297024 | 0.00 | 449824 | 30.20 | 281152 |
|
||||
|
||||
## Maximum Load: chainCount=100, nestingDepth=100 (Mean, PeakRSS)
|
||||
|
||||
| Scenario | cherrypick Mean (us) | cherrypick PeakRSS | get_it Mean (us) | get_it PeakRSS | riverpod Mean (us) | riverpod PeakRSS |
|
||||
|--------------------|---------------------:|-------------------:|-----------------:|---------------:|-------------------:|-----------------:|
|
||||
| RegisterSingleton | 4.00 | 271072 | 1.00 | 262000 | 2.00 | 268688 |
|
||||
| ChainSingleton | 76.60 | 303312 | 2.00 | 297136 | 221.80 | 270784 |
|
||||
| ChainFactory | 80.00 | 293952 | 39.20 | 342720 | 195.80 | 308640 |
|
||||
| AsyncChain | 251.40 | 297008 | 18.20 | 450640 | 748.80 | 285968 |
|
||||
| Named | 2.20 | 297008 | 0.00 | 449824 | 1.00 | 281136 |
|
||||
| Override | 104.80 | 301632 | 2.20 | 477344 | 120.80 | 294752 |
|
||||
| Scenario | cherrypick | get_it | riverpod | kiwi |
|
||||
|------------------|------------|--------|----------|------|
|
||||
| chainSingleton | 47.6 | 13.0 | 389.6 | 46.8 |
|
||||
| chainFactory | 93.6 | 68.4 | 678.4 | 40.8 |
|
||||
| register | 67.4 | 10.2 | 242.2 | 56.2 |
|
||||
| named | 14.2 | 10.6 | 10.4 | 8.2 |
|
||||
| override | 42.2 | 11.2 | 302.8 | 44.6 |
|
||||
| chainAsync | 519.4 | 38.0 | 886.6 | – |
|
||||
|
||||
---
|
||||
|
||||
## Analysis
|
||||
|
||||
- **get_it** is the absolute leader in all scenarios, especially under deep/nested chains and async.
|
||||
- **cherrypick** is highly competitive and much faster than riverpod on any complex graph.
|
||||
- **riverpod** is only suitable for small/simple DI graphs due to major slowdowns with depth, async, or override.
|
||||
- **get_it** and **kiwi** are the fastest in most sync scenarios; cherrypick is solid, riverpod is much slower for deep chains.
|
||||
- **Async scenarios**: Only cherrypick, get_it and riverpod are supported; get_it is much faster. Kiwi does not support async.
|
||||
- **Named** lookups are fast in all DI.
|
||||
- **Riverpod** loses on deeply nested/async chains.
|
||||
- **Memory/peak usage** varies, but mean_us is the main comparison (see raw results for memory).
|
||||
|
||||
### Recommendations
|
||||
- Use **get_it** for performance-critical and deeply nested graphs.
|
||||
- Use **cherrypick** for scalable/testable apps if a small speed loss is acceptable.
|
||||
- Use **riverpod** only if you rely on Flutter integration and your DI chains are simple.
|
||||
- Use **get_it** or **kiwi** for maximum sync performance and simplicity.
|
||||
- Use **cherrypick** for robust, scalable and testable setups — with a small latency cost.
|
||||
- Use **riverpod** only for Flutter apps where integration is paramount and chains are simple.
|
||||
|
||||
---
|
||||
|
||||
_Last updated: August 8, 2025._
|
||||
_Last updated: August 19, 2025._
|
||||
_Please see scenario source for details._
|
||||
|
||||
@@ -1,51 +1,48 @@
|
||||
# Сравнительный отчет DI-бенчмарка: cherrypick vs get_it vs riverpod
|
||||
# Сравнительный отчет DI-бенчмарка: cherrypick vs get_it vs riverpod vs kiwi
|
||||
|
||||
## Параметры запуска:
|
||||
- chainCount = 100
|
||||
- nestingDepth = 100
|
||||
- repeat = 5
|
||||
- warmup = 2
|
||||
|
||||
## Описание сценариев
|
||||
|
||||
1. **RegisterSingleton** — регистрация и получение объекта-синглтона (базовая скорость DI).
|
||||
1. **RegisterSingleton** — регистрация и получение singleton (базовая скорость DI).
|
||||
2. **ChainSingleton** — цепочка зависимостей A → B → ... → N (singleton). Глубокий singleton-резолвинг.
|
||||
3. **ChainFactory** — все элементы цепочки — фабрики. Stateless построение графа.
|
||||
4. **AsyncChain** — асинхронная цепочка (async factory). Тестирует async/await граф.
|
||||
3. **ChainFactory** — все элементы цепочки — factory. Stateless построение графа.
|
||||
4. **AsyncChain** — асинхронная цепочка (async factory). Тест async/await графа.
|
||||
5. **Named** — регистрация двух биндингов с именами, разрешение по имени.
|
||||
6. **Override** — регистрация биндинга/цепочки в дочернем scope. Проверка override/scoping.
|
||||
6. **Override** — регистрация биндинга/цепочки в дочернем scope.
|
||||
|
||||
---
|
||||
|
||||
## Сводная таблица: chainCount=10, nestingDepth=10 (Mean, PeakRSS)
|
||||
## Сравнительная таблица: chainCount=100, nestingDepth=100, repeat=5, warmup=2 (среднее время, мкс)
|
||||
|
||||
| Сценарий | cherrypick Mean (мкс) | cherrypick PeakRSS | get_it Mean (мкс) | get_it PeakRSS | riverpod Mean (мкс) | riverpod PeakRSS |
|
||||
|--------------------|----------------------:|-------------------:|------------------:|---------------:|--------------------:|-----------------:|
|
||||
| RegisterSingleton | 13.00 | 273104 | 8.40 | 261872 | 9.80 | 268512 |
|
||||
| ChainSingleton | 13.80 | 271072 | 2.00 | 262000 | 33.60 | 268784 |
|
||||
| ChainFactory | 5.00 | 299216 | 4.00 | 297136 | 22.80 | 271296 |
|
||||
| AsyncChain | 28.60 | 290640 | 24.60 | 342976 | 78.20 | 285920 |
|
||||
| Named | 2.20 | 297008 | 0.20 | 449824 | 6.20 | 281136 |
|
||||
| Override | 7.00 | 297024 | 0.00 | 449824 | 30.20 | 281152 |
|
||||
|
||||
## Максимальная нагрузка: chainCount=100, nestingDepth=100 (Mean, PeakRSS)
|
||||
|
||||
| Сценарий | cherrypick Mean (мкс) | cherrypick PeakRSS | get_it Mean (мкс) | get_it PeakRSS | riverpod Mean (мкс) | riverpod PeakRSS |
|
||||
|--------------------|----------------------:|-------------------:|------------------:|---------------:|--------------------:|-----------------:|
|
||||
| RegisterSingleton | 4.00 | 271072 | 1.00 | 262000 | 2.00 | 268688 |
|
||||
| ChainSingleton | 76.60 | 303312 | 2.00 | 297136 | 221.80 | 270784 |
|
||||
| ChainFactory | 80.00 | 293952 | 39.20 | 342720 | 195.80 | 308640 |
|
||||
| AsyncChain | 251.40 | 297008 | 18.20 | 450640 | 748.80 | 285968 |
|
||||
| Named | 2.20 | 297008 | 0.00 | 449824 | 1.00 | 281136 |
|
||||
| Override | 104.80 | 301632 | 2.20 | 477344 | 120.80 | 294752 |
|
||||
| Сценарий | cherrypick | get_it | riverpod | kiwi |
|
||||
|------------------|------------|--------|----------|------|
|
||||
| chainSingleton | 47.6 | 13.0 | 389.6 | 46.8 |
|
||||
| chainFactory | 93.6 | 68.4 | 678.4 | 40.8 |
|
||||
| register | 67.4 | 10.2 | 242.2 | 56.2 |
|
||||
| named | 14.2 | 10.6 | 10.4 | 8.2 |
|
||||
| override | 42.2 | 11.2 | 302.8 | 44.6 |
|
||||
| chainAsync | 519.4 | 38.0 | 886.6 | – |
|
||||
|
||||
---
|
||||
|
||||
## Краткий анализ и рекомендации
|
||||
|
||||
- **get_it** всегда лидер, особенно на глубине/асинхронных графах.
|
||||
- **cherrypick** заметно быстрее riverpod на сложных сценариях, опережая его в разы.
|
||||
- **riverpod** подходит только для простых/небольших графов — при росте глубины или async/override резко проигрывает по скорости.
|
||||
- **get_it** и **kiwi** — самые быстрые в большинстве синхронных сценариев.
|
||||
- **cherrypick** надежен и быстр, только немного медленнее.
|
||||
- **riverpod** заметно проигрывает на глубоко вложенных и async-графах.
|
||||
- **Асинхронный сценарий**: get_it — абсолютный лидер, cherrypick и riverpod значительно медленнее, kiwi не поддерживает async.
|
||||
- **named** lookup отрабатывает быстро во всех DI.
|
||||
|
||||
### Рекомендации
|
||||
- Используйте **get_it** для критичных к скорости приложений/сложных графов зависимостей.
|
||||
- Выбирайте **cherrypick** для масштабируемых, тестируемых архитектур, если микросекундная разница не критична.
|
||||
- **riverpod** уместен только для реактивного UI или простых графов DI.
|
||||
- Используйте **get_it** или **kiwi** для максимальной производительности и простоты.
|
||||
- **cherrypick** хорош для масштабируемых решений с небольшой задержкой.
|
||||
- **riverpod** оправдан только для Flutter и простых графов.
|
||||
|
||||
---
|
||||
|
||||
_Обновлено: 8 августа 2025_
|
||||
_Обновлено: 19 августа 2025._
|
||||
|
||||
@@ -16,6 +16,8 @@ import 'package:benchmark_di/benchmarks/universal_chain_async_benchmark.dart';
|
||||
import 'package:benchmark_di/di_adapters/cherrypick_adapter.dart';
|
||||
import 'package:benchmark_di/di_adapters/get_it_adapter.dart';
|
||||
import 'package:benchmark_di/di_adapters/riverpod_adapter.dart';
|
||||
import 'package:benchmark_di/di_adapters/kiwi_adapter.dart';
|
||||
import 'package:kiwi/kiwi.dart';
|
||||
|
||||
/// Command-line interface (CLI) runner for benchmarks.
|
||||
///
|
||||
@@ -61,11 +63,40 @@ class BenchmarkCliRunner {
|
||||
repeats: config.repeats,
|
||||
);
|
||||
}
|
||||
} else if (config.di == 'kiwi') {
|
||||
final di = KiwiAdapter();
|
||||
if (scenario == UniversalScenario.asyncChain) {
|
||||
// UnsupportedError будет выброшен адаптером, но если дойдёт — вызывать async benchmark
|
||||
final benchAsync = UniversalChainAsyncBenchmark<KiwiContainer>(
|
||||
di,
|
||||
chainCount: c,
|
||||
nestingDepth: d,
|
||||
mode: mode,
|
||||
);
|
||||
benchResult = await BenchmarkRunner.runAsync(
|
||||
benchmark: benchAsync,
|
||||
warmups: config.warmups,
|
||||
repeats: config.repeats,
|
||||
);
|
||||
} else {
|
||||
final benchSync = UniversalChainBenchmark<KiwiContainer>(
|
||||
di,
|
||||
chainCount: c,
|
||||
nestingDepth: d,
|
||||
mode: mode,
|
||||
scenario: scenario,
|
||||
);
|
||||
benchResult = await BenchmarkRunner.runSync(
|
||||
benchmark: benchSync,
|
||||
warmups: config.warmups,
|
||||
repeats: config.repeats,
|
||||
);
|
||||
}
|
||||
} else if (config.di == 'riverpod') {
|
||||
final di = RiverpodAdapter();
|
||||
if (scenario == UniversalScenario.asyncChain) {
|
||||
final benchAsync = UniversalChainAsyncBenchmark<
|
||||
Map<String, rp.ProviderBase<Object?>>>(
|
||||
Map<String, rp.ProviderBase<Object?>>> (
|
||||
di,
|
||||
chainCount: c,
|
||||
nestingDepth: d,
|
||||
@@ -78,7 +109,7 @@ class BenchmarkCliRunner {
|
||||
);
|
||||
} else {
|
||||
final benchSync = UniversalChainBenchmark<
|
||||
Map<String, rp.ProviderBase<Object?>>>(
|
||||
Map<String, rp.ProviderBase<Object?>>> (
|
||||
di,
|
||||
chainCount: c,
|
||||
nestingDepth: d,
|
||||
|
||||
@@ -184,9 +184,9 @@ class CherrypickDIAdapter extends DIAdapter<Scope> {
|
||||
_scope!.resolveAsync<T>(named: named);
|
||||
|
||||
@override
|
||||
void teardown() {
|
||||
Future<void> teardown() async {
|
||||
if (!_isSubScope) {
|
||||
CherryPick.closeRootScope();
|
||||
await CherryPick.closeRootScope();
|
||||
_scope = null;
|
||||
}
|
||||
// SubScope teardown не требуется
|
||||
|
||||
129
benchmark_di/lib/di_adapters/kiwi_adapter.dart
Normal file
129
benchmark_di/lib/di_adapters/kiwi_adapter.dart
Normal file
@@ -0,0 +1,129 @@
|
||||
import 'package:benchmark_di/scenarios/universal_binding_mode.dart';
|
||||
import 'package:benchmark_di/scenarios/universal_scenario.dart';
|
||||
import 'package:benchmark_di/scenarios/universal_service.dart';
|
||||
import 'package:kiwi/kiwi.dart';
|
||||
import 'di_adapter.dart';
|
||||
|
||||
/// DIAdapter-для KiwiContainer с поддержкой universal benchmark сценариев.
|
||||
class KiwiAdapter extends DIAdapter<KiwiContainer> {
|
||||
late KiwiContainer _container;
|
||||
// ignore: unused_field
|
||||
final bool _isSubScope;
|
||||
|
||||
KiwiAdapter({KiwiContainer? container, bool isSubScope = false})
|
||||
: _isSubScope = isSubScope {
|
||||
_container = container ?? KiwiContainer();
|
||||
}
|
||||
|
||||
@override
|
||||
void setupDependencies(void Function(KiwiContainer container) registration) {
|
||||
registration(_container);
|
||||
}
|
||||
|
||||
@override
|
||||
Registration<KiwiContainer> universalRegistration<S extends Enum>({
|
||||
required S scenario,
|
||||
required int chainCount,
|
||||
required int nestingDepth,
|
||||
required UniversalBindingMode bindingMode,
|
||||
}) {
|
||||
if (scenario is UniversalScenario) {
|
||||
if (scenario == UniversalScenario.asyncChain ||
|
||||
bindingMode == UniversalBindingMode.asyncStrategy) {
|
||||
throw UnsupportedError('Kiwi does not support async dependencies or async binding scenarios.');
|
||||
}
|
||||
return (container) {
|
||||
switch (scenario) {
|
||||
case UniversalScenario.asyncChain:
|
||||
break;
|
||||
case UniversalScenario.register:
|
||||
container.registerSingleton<UniversalService>(
|
||||
(c) => UniversalServiceImpl(value: 'reg', dependency: null),
|
||||
);
|
||||
break;
|
||||
case UniversalScenario.named:
|
||||
container.registerFactory<UniversalService>(
|
||||
(c) => UniversalServiceImpl(value: 'impl1'), name: 'impl1');
|
||||
container.registerFactory<UniversalService>(
|
||||
(c) => UniversalServiceImpl(value: 'impl2'), name: 'impl2');
|
||||
break;
|
||||
case UniversalScenario.chain:
|
||||
for (int chain = 1; chain <= chainCount; chain++) {
|
||||
for (int level = 1; level <= nestingDepth; level++) {
|
||||
final prevDepName = '${chain}_${level - 1}';
|
||||
final depName = '${chain}_$level';
|
||||
switch (bindingMode) {
|
||||
case UniversalBindingMode.singletonStrategy:
|
||||
container.registerSingleton<UniversalService>(
|
||||
(c) => UniversalServiceImpl(
|
||||
value: depName,
|
||||
dependency: level > 1
|
||||
? c.resolve<UniversalService>(prevDepName)
|
||||
: null),
|
||||
name: depName);
|
||||
break;
|
||||
case UniversalBindingMode.factoryStrategy:
|
||||
container.registerFactory<UniversalService>(
|
||||
(c) => UniversalServiceImpl(
|
||||
value: depName,
|
||||
dependency: level > 1
|
||||
? c.resolve<UniversalService>(prevDepName)
|
||||
: null),
|
||||
name: depName);
|
||||
break;
|
||||
case UniversalBindingMode.asyncStrategy:
|
||||
// Не поддерживается
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
final depName = '${chainCount}_$nestingDepth';
|
||||
container.registerSingleton<UniversalService>(
|
||||
(c) => c.resolve<UniversalService>(depName));
|
||||
break;
|
||||
case UniversalScenario.override:
|
||||
final depName = '${chainCount}_$nestingDepth';
|
||||
container.registerSingleton<UniversalService>(
|
||||
(c) => c.resolve<UniversalService>(depName));
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
throw UnsupportedError('Scenario $scenario not supported by KiwiAdapter');
|
||||
}
|
||||
|
||||
@override
|
||||
T resolve<T extends Object>({String? named}) {
|
||||
// Для asyncChain нужен resolve<Future<T>>
|
||||
if (T.toString().startsWith('Future<')) {
|
||||
return _container.resolve<T>(named);
|
||||
} else {
|
||||
return _container.resolve<T>(named);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<T> resolveAsync<T extends Object>({String? named}) async {
|
||||
if (T.toString().startsWith('Future<')) {
|
||||
// resolve<Future<T>>, unwrap result
|
||||
return Future.value(_container.resolve<T>(named));
|
||||
} else {
|
||||
// Для совместимости с chain/override
|
||||
return Future.value(_container.resolve<T>(named));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void teardown() {
|
||||
_container.clear();
|
||||
}
|
||||
|
||||
@override
|
||||
KiwiAdapter openSubScope(String name) {
|
||||
// Возвращаем новый scoped контейнер (отдельный). Наследование не реализовано.
|
||||
return KiwiAdapter(container: KiwiContainer.scoped(), isSubScope: true);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> waitForAsyncReady() async {}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ packages:
|
||||
path: "../cherrypick"
|
||||
relative: true
|
||||
source: path
|
||||
version: "3.0.0-dev.9"
|
||||
version: "3.0.0-dev.10"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -72,6 +72,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.2.0"
|
||||
kiwi:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: kiwi
|
||||
sha256: d078364a90fb1b93852bb74468efdf4aaae35c036c538c1cf4f9c74a19df9a61
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.1"
|
||||
lazy_memo:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -12,6 +12,7 @@ dependencies:
|
||||
args: ^2.7.0
|
||||
get_it: ^8.2.0
|
||||
riverpod: ^2.6.1
|
||||
kiwi: ^5.0.1
|
||||
|
||||
dev_dependencies:
|
||||
lints: ^5.0.0
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
## 3.0.0-dev.12
|
||||
|
||||
- **FIX**(scope): prevent concurrent modification in dispose().
|
||||
- **FIX**(binding): fix unterminated string literal and syntax issues in binding.dart.
|
||||
|
||||
## 3.0.0-dev.11
|
||||
|
||||
- **FIX**(scope): prevent concurrent modification in dispose().
|
||||
- **FIX**(binding): fix unterminated string literal and syntax issues in binding.dart.
|
||||
|
||||
## 3.0.0-dev.10
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
## 3.0.0-dev.9
|
||||
|
||||
- **DOCS**(readme): add talker_cherrypick_logger to Additional Modules section.
|
||||
|
||||
Binary file not shown.
@@ -486,16 +486,16 @@ class Scope with CycleDetectionMixin, GlobalCycleDetectionMixin {
|
||||
/// await myScope.dispose();
|
||||
/// ```
|
||||
Future<void> dispose() async {
|
||||
// First dispose children scopes
|
||||
for (final subScope in _scopeMap.values) {
|
||||
// Create copies to avoid concurrent modification
|
||||
final scopesCopy = Map<String, Scope>.from(_scopeMap);
|
||||
for (final subScope in scopesCopy.values) {
|
||||
await subScope.dispose();
|
||||
}
|
||||
_scopeMap.clear();
|
||||
// Then dispose own disposables
|
||||
for (final d in _disposables) {
|
||||
try {
|
||||
await d.dispose();
|
||||
} catch (_) {}
|
||||
|
||||
final disposablesCopy = Set<Disposable>.from(_disposables);
|
||||
for (final d in disposablesCopy) {
|
||||
await d.dispose();
|
||||
}
|
||||
_disposables.clear();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
name: cherrypick
|
||||
description: Cherrypick is a small dependency injection (DI) library for dart/flutter projects.
|
||||
version: 3.0.0-dev.9
|
||||
homepage: https://pese-git.github.io/cherrypick-site/
|
||||
documentation: https://github.com/pese-git/cherrypick/wiki
|
||||
version: 3.0.0-dev.12
|
||||
homepage: https://cherrypick-di.dev/
|
||||
documentation: https://cherrypick-di.dev/docs/intro
|
||||
repository: https://github.com/pese-git/cherrypick
|
||||
issue_tracker: https://github.com/pese-git/cherrypick/issues
|
||||
topics:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
## 1.1.2-dev.1
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
## 1.1.2-dev.0
|
||||
|
||||
- **DOCS**(annotations): unify and improve English DartDoc for all DI annotations.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
name: cherrypick_annotations
|
||||
description: |
|
||||
Set of annotations for CherryPick dependency injection library. Enables code generation and declarative DI for Dart & Flutter projects.
|
||||
version: 1.1.2-dev.0
|
||||
documentation: https://github.com/pese-git/cherrypick/wiki
|
||||
version: 1.1.2-dev.1
|
||||
homepage: https://cherrypick-di.dev/
|
||||
documentation: https://cherrypick-di.dev/docs/intro
|
||||
repository: https://github.com/pese-git/cherrypick/cherrypick_annotations
|
||||
issue_tracker: https://github.com/pese-git/cherrypick/issues
|
||||
topics:
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
## 1.1.3-dev.12
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 1.1.3-dev.11
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 1.1.3-dev.10
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
## 1.1.3-dev.9
|
||||
|
||||
- **DOCS**(provider): add detailed English API documentation for CherryPickProvider Flutter integration.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
name: cherrypick_flutter
|
||||
description: "Flutter library that allows access to the root scope through the context using `CherryPickProvider`."
|
||||
version: 1.1.3-dev.9
|
||||
homepage: https://pese-git.github.io/cherrypick-site/
|
||||
documentation: https://github.com/pese-git/cherrypick/wiki
|
||||
version: 1.1.3-dev.12
|
||||
homepage: https://cherrypick-di.dev/
|
||||
documentation: https://cherrypick-di.dev/docs/intro
|
||||
repository: https://github.com/pese-git/cherrypick
|
||||
issue_tracker: https://github.com/pese-git/cherrypick/issues
|
||||
topics:
|
||||
@@ -19,7 +19,7 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
cherrypick: ^3.0.0-dev.9
|
||||
cherrypick: ^3.0.0-dev.12
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
## 2.0.0-dev.1
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
## 2.0.0-dev.0
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
@@ -2,8 +2,9 @@ name: cherrypick_generator
|
||||
description: |
|
||||
Source code generator for the cherrypick dependency injection system. Processes annotations to generate binding and module code for Dart & Flutter projects.
|
||||
|
||||
version: 2.0.0-dev.0
|
||||
documentation: https://github.com/pese-git/cherrypick/wiki
|
||||
version: 2.0.0-dev.1
|
||||
homepage: https://cherrypick-di.dev/
|
||||
documentation: https://cherrypick-di.dev/docs/intro
|
||||
repository: https://github.com/pese-git/cherrypick/cherrypick_generator
|
||||
issue_tracker: https://github.com/pese-git/cherrypick/issues
|
||||
topics:
|
||||
@@ -18,7 +19,7 @@ environment:
|
||||
|
||||
# Add regular dependencies here.
|
||||
dependencies:
|
||||
cherrypick_annotations: ^1.1.2-dev.0
|
||||
cherrypick_annotations: ^1.1.2-dev.1
|
||||
analyzer: ^7.0.0
|
||||
dart_style: ^3.0.0
|
||||
build: ^2.4.1
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
## 1.1.0-dev.7
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 1.1.0-dev.6
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 1.1.0-dev.5
|
||||
|
||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||
|
||||
## 1.1.0-dev.4
|
||||
|
||||
- **DOCS**(readme): update install instructions to use pub.dev as default method and remove obsolete git example.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
name: talker_cherrypick_logger
|
||||
description: A Talker logger integration for CherryPick DI to observe and log DI events and errors.
|
||||
version: 1.1.0-dev.4
|
||||
homepage: https://pese-git.github.io/cherrypick-site/
|
||||
documentation: https://github.com/pese-git/cherrypick/wiki
|
||||
version: 1.1.0-dev.7
|
||||
homepage: https://cherrypick-di.dev/
|
||||
documentation: https://cherrypick-di.dev/docs/intro
|
||||
repository: https://github.com/pese-git/cherrypick
|
||||
issue_tracker: https://github.com/pese-git/cherrypick/issues
|
||||
|
||||
@@ -18,7 +18,7 @@ environment:
|
||||
# Add regular dependencies here.
|
||||
dependencies:
|
||||
talker: ^4.9.3
|
||||
cherrypick: ^3.0.0-dev.9
|
||||
cherrypick: ^3.0.0-dev.12
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Reference in New Issue
Block a user