mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-03-25 04:40:33 +00:00
Compare commits
2 Commits
3331a3ee9c
...
issues/26
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72e1e91b96 | ||
|
|
e67ebbe2ab |
@@ -1,3 +1,7 @@
|
||||
## Unreleased
|
||||
|
||||
- **BREAKING** **REFACTOR**(binding): rename `Provider<T>` typedef to `ProviderFactory<T>` to avoid naming conflicts with `package:provider`.
|
||||
|
||||
## 3.0.2
|
||||
|
||||
- **FIX**(test): fix warning.
|
||||
@@ -188,4 +192,4 @@
|
||||
- **MAINT**: Updated pubspec.
|
||||
|
||||
## 0.1.0
|
||||
- **INIT**: Initial release.
|
||||
- **INIT**: Initial release.
|
||||
|
||||
@@ -205,7 +205,7 @@ class Binding<T> {
|
||||
/// bind<Api>().toProvide(() => ApiService());
|
||||
/// bind<Db>().toProvide(() async => await openDb());
|
||||
/// ```
|
||||
Binding<T> toProvide(Provider<T> value) {
|
||||
Binding<T> toProvide(ProviderFactory<T> value) {
|
||||
_resolver = ProviderResolver<T>((_) => value.call(), withParams: false);
|
||||
return this;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ class Binding<T> {
|
||||
}
|
||||
|
||||
@Deprecated('Use toProvide instead of toProvideAsync')
|
||||
Binding<T> toProvideAsync(Provider<T> value) {
|
||||
Binding<T> toProvideAsync(ProviderFactory<T> value) {
|
||||
return toProvide(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ typedef Instance<T> = FutureOr<T>;
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// Provider<MyService> provider = () => MyService();
|
||||
/// Provider<Api> asyncProvider = () async => await Api.connect();
|
||||
/// ProviderFactory<MyService> provider = () => MyService();
|
||||
/// ProviderFactory<Api> asyncProvider = () async => await Api.connect();
|
||||
/// ```
|
||||
typedef Provider<T> = FutureOr<T> Function();
|
||||
typedef ProviderFactory<T> = FutureOr<T> Function();
|
||||
|
||||
/// Provider function type that accepts a dynamic parameter, for factory/parametrized injection.
|
||||
/// Returns [T] or [Future<T>].
|
||||
|
||||
@@ -550,4 +550,4 @@ void main() {
|
||||
- [cherrypick](https://pub.dev/packages/cherrypick)
|
||||
- [cherrypick_annotations](https://pub.dev/packages/cherrypick_annotations)
|
||||
- [cherrypick_generator](https://pub.dev/packages/cherrypick_generator)
|
||||
- [Исходники на GitHub](https://github.com/pese-git/cherrypick)
|
||||
- [Исходники на GitHub](https://github.com/pese-git/cherrypick)
|
||||
|
||||
@@ -255,4 +255,4 @@ class ApiClientImpl implements ApiClient {
|
||||
return 'Network data';
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
@@ -38,4 +38,4 @@ See [Installation](installation.md) for instructions on adding CherryPick to you
|
||||
|
||||
CherryPick is open-source. Contributions and questions are welcome!
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user