Added of(context) extension to ArcaneService

This commit is contained in:
Hans Kokx
2025-04-10 13:01:07 +02:00
committed by Hans Kokx
parent d4dc176356
commit e901da8080
+4 -1
View File
@@ -105,4 +105,7 @@ extension ServiceProvider on BuildContext {
/// to notify listeners of changes. Services are typically registered in
/// `ArcaneServiceProvider` and can be accessed using the `serviceOfType`
/// method on `BuildContext`.
abstract class ArcaneService with ChangeNotifier {}
abstract class ArcaneService with ChangeNotifier {
static T? of<T extends ArcaneService>(BuildContext context) =>
context.serviceOfType<T>();
}