mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 13:47:24 +00:00
fixed initialization error for singeltone provider
This commit is contained in:
@@ -96,9 +96,6 @@ class Binding<T> {
|
||||
///
|
||||
/// return [Binding]
|
||||
Binding<T> singeltone() {
|
||||
if (_mode == Mode.PROVIDER_INSTANCE) {
|
||||
_instance = _provider?.call();
|
||||
}
|
||||
_isSingeltone = true;
|
||||
return this;
|
||||
}
|
||||
@@ -113,5 +110,11 @@ class Binding<T> {
|
||||
/// ENG: Resolve instance.
|
||||
///
|
||||
/// return [T]
|
||||
T? get provider => _provider?.call();
|
||||
T? get provider {
|
||||
if (_isSingeltone) {
|
||||
_instance ??= _provider?.call();
|
||||
return _instance;
|
||||
}
|
||||
return _provider?.call();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user