mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-03-25 04:40:33 +00:00
rename Provider typedef to ProviderFactory
This commit is contained in:
@@ -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>].
|
||||
|
||||
Reference in New Issue
Block a user