KiwiContainer.scoped constructor
KiwiContainer.scoped({
- KiwiContainer? parent,
Creates a scoped container.
If parent
is set, the new scoped instance will include its providers.
Implementation
KiwiContainer.scoped({
KiwiContainer? parent,
}) : _providers = <_ProviderName?, _ProviderValue>{
if (parent != null)
...parent._providers.map(
// [Map.from] is needed to create a copy of value and not use its reference,
// because if only value is passed, everything included in the parent will be
// added to the new instance at any time, even after this scoped instance has been created.
(key, value) => MapEntry(key, Map.from(value)),
),
};