mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 05:25:19 +00:00
Compare commits
7 Commits
talker_che
...
talker_che
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ef12e990f | ||
|
|
5c57370755 | ||
|
|
8711dc83d0 | ||
|
|
043737e2c9 | ||
|
|
ed65e3c23d | ||
|
|
a897c1b31b | ||
|
|
dd9c3faa62 |
62
CHANGELOG.md
62
CHANGELOG.md
@@ -3,6 +3,68 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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
|
## 2025-08-15
|
||||||
|
|
||||||
### Changes
|
### 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
|
## 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 |
|
| Scenario | cherrypick | get_it | riverpod | kiwi |
|
||||||
|--------------------|---------------------:|-------------------:|-----------------:|---------------:|-------------------:|-----------------:|
|
|------------------|------------|--------|----------|------|
|
||||||
| RegisterSingleton | 13.00 | 273104 | 8.40 | 261872 | 9.80 | 268512 |
|
| chainSingleton | 47.6 | 13.0 | 389.6 | 46.8 |
|
||||||
| ChainSingleton | 13.80 | 271072 | 2.00 | 262000 | 33.60 | 268784 |
|
| chainFactory | 93.6 | 68.4 | 678.4 | 40.8 |
|
||||||
| ChainFactory | 5.00 | 299216 | 4.00 | 297136 | 22.80 | 271296 |
|
| register | 67.4 | 10.2 | 242.2 | 56.2 |
|
||||||
| AsyncChain | 28.60 | 290640 | 24.60 | 342976 | 78.20 | 285920 |
|
| named | 14.2 | 10.6 | 10.4 | 8.2 |
|
||||||
| Named | 2.20 | 297008 | 0.20 | 449824 | 6.20 | 281136 |
|
| override | 42.2 | 11.2 | 302.8 | 44.6 |
|
||||||
| Override | 7.00 | 297024 | 0.00 | 449824 | 30.20 | 281152 |
|
| chainAsync | 519.4 | 38.0 | 886.6 | – |
|
||||||
|
|
||||||
## 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 |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Analysis
|
## Analysis
|
||||||
|
|
||||||
- **get_it** is the absolute leader in all scenarios, especially under deep/nested chains and async.
|
- **get_it** and **kiwi** are the fastest in most sync scenarios; cherrypick is solid, riverpod is much slower for deep chains.
|
||||||
- **cherrypick** is highly competitive and much faster than riverpod on any complex graph.
|
- **Async scenarios**: Only cherrypick, get_it and riverpod are supported; get_it is much faster. Kiwi does not support async.
|
||||||
- **riverpod** is only suitable for small/simple DI graphs due to major slowdowns with depth, async, or override.
|
- **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
|
### Recommendations
|
||||||
- Use **get_it** for performance-critical and deeply nested graphs.
|
- Use **get_it** or **kiwi** for maximum sync performance and simplicity.
|
||||||
- Use **cherrypick** for scalable/testable apps if a small speed loss is acceptable.
|
- Use **cherrypick** for robust, scalable and testable setups — with a small latency cost.
|
||||||
- Use **riverpod** only if you rely on Flutter integration and your DI chains are simple.
|
- 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-резолвинг.
|
2. **ChainSingleton** — цепочка зависимостей A → B → ... → N (singleton). Глубокий singleton-резолвинг.
|
||||||
3. **ChainFactory** — все элементы цепочки — фабрики. Stateless построение графа.
|
3. **ChainFactory** — все элементы цепочки — factory. Stateless построение графа.
|
||||||
4. **AsyncChain** — асинхронная цепочка (async factory). Тестирует async/await граф.
|
4. **AsyncChain** — асинхронная цепочка (async factory). Тест async/await графа.
|
||||||
5. **Named** — регистрация двух биндингов с именами, разрешение по имени.
|
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 |
|
| Сценарий | cherrypick | get_it | riverpod | kiwi |
|
||||||
|--------------------|----------------------:|-------------------:|------------------:|---------------:|--------------------:|-----------------:|
|
|------------------|------------|--------|----------|------|
|
||||||
| RegisterSingleton | 13.00 | 273104 | 8.40 | 261872 | 9.80 | 268512 |
|
| chainSingleton | 47.6 | 13.0 | 389.6 | 46.8 |
|
||||||
| ChainSingleton | 13.80 | 271072 | 2.00 | 262000 | 33.60 | 268784 |
|
| chainFactory | 93.6 | 68.4 | 678.4 | 40.8 |
|
||||||
| ChainFactory | 5.00 | 299216 | 4.00 | 297136 | 22.80 | 271296 |
|
| register | 67.4 | 10.2 | 242.2 | 56.2 |
|
||||||
| AsyncChain | 28.60 | 290640 | 24.60 | 342976 | 78.20 | 285920 |
|
| named | 14.2 | 10.6 | 10.4 | 8.2 |
|
||||||
| Named | 2.20 | 297008 | 0.20 | 449824 | 6.20 | 281136 |
|
| override | 42.2 | 11.2 | 302.8 | 44.6 |
|
||||||
| Override | 7.00 | 297024 | 0.00 | 449824 | 30.20 | 281152 |
|
| chainAsync | 519.4 | 38.0 | 886.6 | – |
|
||||||
|
|
||||||
## Максимальная нагрузка: 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 |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Краткий анализ и рекомендации
|
## Краткий анализ и рекомендации
|
||||||
|
|
||||||
- **get_it** всегда лидер, особенно на глубине/асинхронных графах.
|
- **get_it** и **kiwi** — самые быстрые в большинстве синхронных сценариев.
|
||||||
- **cherrypick** заметно быстрее riverpod на сложных сценариях, опережая его в разы.
|
- **cherrypick** надежен и быстр, только немного медленнее.
|
||||||
- **riverpod** подходит только для простых/небольших графов — при росте глубины или async/override резко проигрывает по скорости.
|
- **riverpod** заметно проигрывает на глубоко вложенных и async-графах.
|
||||||
|
- **Асинхронный сценарий**: get_it — абсолютный лидер, cherrypick и riverpod значительно медленнее, kiwi не поддерживает async.
|
||||||
|
- **named** lookup отрабатывает быстро во всех DI.
|
||||||
|
|
||||||
### Рекомендации
|
### Рекомендации
|
||||||
- Используйте **get_it** для критичных к скорости приложений/сложных графов зависимостей.
|
- Используйте **get_it** или **kiwi** для максимальной производительности и простоты.
|
||||||
- Выбирайте **cherrypick** для масштабируемых, тестируемых архитектур, если микросекундная разница не критична.
|
- **cherrypick** хорош для масштабируемых решений с небольшой задержкой.
|
||||||
- **riverpod** уместен только для реактивного UI или простых графов DI.
|
- **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/cherrypick_adapter.dart';
|
||||||
import 'package:benchmark_di/di_adapters/get_it_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/riverpod_adapter.dart';
|
||||||
|
import 'package:benchmark_di/di_adapters/kiwi_adapter.dart';
|
||||||
|
import 'package:kiwi/kiwi.dart';
|
||||||
|
|
||||||
/// Command-line interface (CLI) runner for benchmarks.
|
/// Command-line interface (CLI) runner for benchmarks.
|
||||||
///
|
///
|
||||||
@@ -61,6 +63,35 @@ class BenchmarkCliRunner {
|
|||||||
repeats: config.repeats,
|
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') {
|
} else if (config.di == 'riverpod') {
|
||||||
final di = RiverpodAdapter();
|
final di = RiverpodAdapter();
|
||||||
if (scenario == UniversalScenario.asyncChain) {
|
if (scenario == UniversalScenario.asyncChain) {
|
||||||
|
|||||||
@@ -184,9 +184,9 @@ class CherrypickDIAdapter extends DIAdapter<Scope> {
|
|||||||
_scope!.resolveAsync<T>(named: named);
|
_scope!.resolveAsync<T>(named: named);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void teardown() {
|
Future<void> teardown() async {
|
||||||
if (!_isSubScope) {
|
if (!_isSubScope) {
|
||||||
CherryPick.closeRootScope();
|
await CherryPick.closeRootScope();
|
||||||
_scope = null;
|
_scope = null;
|
||||||
}
|
}
|
||||||
// SubScope teardown не требуется
|
// 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"
|
path: "../cherrypick"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0-dev.9"
|
version: "3.0.0-dev.10"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -72,6 +72,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.2.0"
|
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:
|
lazy_memo:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ dependencies:
|
|||||||
args: ^2.7.0
|
args: ^2.7.0
|
||||||
get_it: ^8.2.0
|
get_it: ^8.2.0
|
||||||
riverpod: ^2.6.1
|
riverpod: ^2.6.1
|
||||||
|
kiwi: ^5.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
lints: ^5.0.0
|
lints: ^5.0.0
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
## 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
|
## 3.0.0-dev.10
|
||||||
|
|
||||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||||
|
|||||||
Binary file not shown.
@@ -486,16 +486,16 @@ class Scope with CycleDetectionMixin, GlobalCycleDetectionMixin {
|
|||||||
/// await myScope.dispose();
|
/// await myScope.dispose();
|
||||||
/// ```
|
/// ```
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
// First dispose children scopes
|
// Create copies to avoid concurrent modification
|
||||||
for (final subScope in _scopeMap.values) {
|
final scopesCopy = Map<String, Scope>.from(_scopeMap);
|
||||||
|
for (final subScope in scopesCopy.values) {
|
||||||
await subScope.dispose();
|
await subScope.dispose();
|
||||||
}
|
}
|
||||||
_scopeMap.clear();
|
_scopeMap.clear();
|
||||||
// Then dispose own disposables
|
|
||||||
for (final d in _disposables) {
|
final disposablesCopy = Set<Disposable>.from(_disposables);
|
||||||
try {
|
for (final d in disposablesCopy) {
|
||||||
await d.dispose();
|
await d.dispose();
|
||||||
} catch (_) {}
|
|
||||||
}
|
}
|
||||||
_disposables.clear();
|
_disposables.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: cherrypick
|
name: cherrypick
|
||||||
description: Cherrypick is a small dependency injection (DI) library for dart/flutter projects.
|
description: Cherrypick is a small dependency injection (DI) library for dart/flutter projects.
|
||||||
version: 3.0.0-dev.10
|
version: 3.0.0-dev.12
|
||||||
homepage: https://cherrypick-di.dev/
|
homepage: https://cherrypick-di.dev/
|
||||||
documentation: https://cherrypick-di.dev/docs/intro
|
documentation: https://cherrypick-di.dev/docs/intro
|
||||||
repository: https://github.com/pese-git/cherrypick
|
repository: https://github.com/pese-git/cherrypick
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
## 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
|
## 1.1.3-dev.10
|
||||||
|
|
||||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: cherrypick_flutter
|
name: cherrypick_flutter
|
||||||
description: "Flutter library that allows access to the root scope through the context using `CherryPickProvider`."
|
description: "Flutter library that allows access to the root scope through the context using `CherryPickProvider`."
|
||||||
version: 1.1.3-dev.10
|
version: 1.1.3-dev.12
|
||||||
homepage: https://cherrypick-di.dev/
|
homepage: https://cherrypick-di.dev/
|
||||||
documentation: https://cherrypick-di.dev/docs/intro
|
documentation: https://cherrypick-di.dev/docs/intro
|
||||||
repository: https://github.com/pese-git/cherrypick
|
repository: https://github.com/pese-git/cherrypick
|
||||||
@@ -19,7 +19,7 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
cherrypick: ^3.0.0-dev.10
|
cherrypick: ^3.0.0-dev.12
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
## 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
|
## 1.1.0-dev.5
|
||||||
|
|
||||||
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
- **DOCS**(pub): update homepage and documentation URLs in pubspec.yaml to new official site.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: talker_cherrypick_logger
|
name: talker_cherrypick_logger
|
||||||
description: A Talker logger integration for CherryPick DI to observe and log DI events and errors.
|
description: A Talker logger integration for CherryPick DI to observe and log DI events and errors.
|
||||||
version: 1.1.0-dev.5
|
version: 1.1.0-dev.7
|
||||||
homepage: https://cherrypick-di.dev/
|
homepage: https://cherrypick-di.dev/
|
||||||
documentation: https://cherrypick-di.dev/docs/intro
|
documentation: https://cherrypick-di.dev/docs/intro
|
||||||
repository: https://github.com/pese-git/cherrypick
|
repository: https://github.com/pese-git/cherrypick
|
||||||
@@ -18,7 +18,7 @@ environment:
|
|||||||
# Add regular dependencies here.
|
# Add regular dependencies here.
|
||||||
dependencies:
|
dependencies:
|
||||||
talker: ^4.9.3
|
talker: ^4.9.3
|
||||||
cherrypick: ^3.0.0-dev.10
|
cherrypick: ^3.0.0-dev.12
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user