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>>> {
|
||||
/// A list of `ArcaneService` instances available through the provider.
|
||||
List<ArcaneService> get registeredServices =>
|
||||
List<ArcaneService>.from(notifier?.value ?? []);
|
||||
List<ArcaneService>.from([...?notifier?.value]);
|
||||
|
||||
/// 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.
|
||||
ArcaneServiceProvider({
|
||||
required List<ArcaneService> serviceInstances,
|
||||
required super.child,
|
||||
List<ArcaneService> serviceInstances = const [],
|
||||
super.key,
|
||||
}) : super(
|
||||
notifier: ValueNotifier<List<ArcaneService>>(serviceInstances),
|
||||
|
||||
Reference in New Issue
Block a user