mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
doc: update manual
This commit is contained in:
@@ -99,7 +99,7 @@ final scope = CherryPick.openRootScope()
|
|||||||
..installModules([$MyModule()]);
|
..installModules([$MyModule()]);
|
||||||
|
|
||||||
final repo = scope.resolve<DataRepository>();
|
final repo = scope.resolve<DataRepository>();
|
||||||
final greeting = scope.resolveWithParams<String>('John'); // 'Hello, John!'
|
final greeting = scope.resolve<String>(params: 'John'); // 'Hello, John!'
|
||||||
```
|
```
|
||||||
|
|
||||||
_For Flutter, wrap your app with `CherryPickProvider` for DI scopes in the widget tree:_
|
_For Flutter, wrap your app with `CherryPickProvider` for DI scopes in the widget tree:_
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ Allows you to create dependencies with runtime parameters, e.g., a service for a
|
|||||||
bind<UserService>().toProvideWithParams((userId) => UserService(userId));
|
bind<UserService>().toProvideWithParams((userId) => UserService(userId));
|
||||||
|
|
||||||
// Resolve:
|
// Resolve:
|
||||||
final userService = scope.resolveWithParams<UserService>(params: '123');
|
final userService = scope.resolve<UserService>(params: '123');
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ final api = scope.resolve<ApiClient>(named: 'mock');
|
|||||||
bind<UserService>().toProvideWithParams((userId) => UserService(userId));
|
bind<UserService>().toProvideWithParams((userId) => UserService(userId));
|
||||||
|
|
||||||
// Получение
|
// Получение
|
||||||
final userService = scope.resolveWithParams<UserService>(params: '123');
|
final userService = scope.resolve<UserService>(params: '123');
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user