mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-05-14 02:19:08 +02:00
Update ServiceProvider to make service instances optional
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -21,14 +21,14 @@ class ArcaneServiceProvider
|
|||||||
extends InheritedNotifier<ValueNotifier<List<ArcaneService>>> {
|
extends InheritedNotifier<ValueNotifier<List<ArcaneService>>> {
|
||||||
/// A list of `ArcaneService` instances available through the provider.
|
/// A list of `ArcaneService` instances available through the provider.
|
||||||
List<ArcaneService> get registeredServices =>
|
List<ArcaneService> get registeredServices =>
|
||||||
List<ArcaneService>.from(notifier?.value ?? []);
|
List<ArcaneService>.from([...?notifier?.value]);
|
||||||
|
|
||||||
/// Creates an `ArcaneServiceProvider` that provides [serviceInstances] to the widget tree.
|
/// Creates an `ArcaneServiceProvider` that provides [serviceInstances] to the widget tree.
|
||||||
///
|
///
|
||||||
/// The [child] widget will be the root of the widget subtree that has access to the services.
|
/// The [child] widget will be the root of the widget subtree that has access to the services.
|
||||||
ArcaneServiceProvider({
|
ArcaneServiceProvider({
|
||||||
required List<ArcaneService> serviceInstances,
|
|
||||||
required super.child,
|
required super.child,
|
||||||
|
List<ArcaneService> serviceInstances = const [],
|
||||||
super.key,
|
super.key,
|
||||||
}) : super(
|
}) : super(
|
||||||
notifier: ValueNotifier<List<ArcaneService>>(serviceInstances),
|
notifier: ValueNotifier<List<ArcaneService>>(serviceInstances),
|
||||||
|
|||||||
Reference in New Issue
Block a user