Put service locators in an extension

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2025-04-29 16:40:20 +02:00
parent 87f86d8117
commit a04038afc3
+3 -1
View File
@@ -162,7 +162,9 @@ extension ServiceProviderExtension on BuildContext {
/// to notify listeners of changes. Services are typically registered in /// to notify listeners of changes. Services are typically registered in
/// `ArcaneServiceProvider` and can be accessed using the `service` /// `ArcaneServiceProvider` and can be accessed using the `service`
/// method on `BuildContext`. /// method on `BuildContext`.
abstract class ArcaneService with ChangeNotifier { abstract class ArcaneService<T> with ChangeNotifier {}
extension ArcaneServiceLocators<T> on ArcaneService {
/// Retrieves a service of the specified type from the context. /// Retrieves a service of the specified type from the context.
/// ///
/// Returns null if no service of type `T` is found. /// Returns null if no service of type `T` is found.