Compare commits

...

2 Commits

Author SHA1 Message Date
Sergey Penkovsky
72e1e91b96 docs: sync references after ProviderFactory rename 2026-03-24 10:54:01 +03:00
Sergey Penkovsky
e67ebbe2ab rename Provider typedef to ProviderFactory 2026-03-24 10:40:49 +03:00
6 changed files with 13 additions and 9 deletions

View File

@@ -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.

View File

@@ -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);
}

View File

@@ -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>].

View File

@@ -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)

View File

@@ -255,4 +255,4 @@ class ApiClientImpl implements ApiClient {
return 'Network data';
}
}
```
```

View File

@@ -38,4 +38,4 @@ See [Installation](installation.md) for instructions on adding CherryPick to you
CherryPick is open-source. Contributions and questions are welcome!
---
---