mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-05-14 02:19:08 +02:00
Added of(context) extension to ArcaneService
This commit is contained in:
@@ -105,4 +105,7 @@ extension ServiceProvider 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 `serviceOfType`
|
/// `ArcaneServiceProvider` and can be accessed using the `serviceOfType`
|
||||||
/// method on `BuildContext`.
|
/// method on `BuildContext`.
|
||||||
abstract class ArcaneService with ChangeNotifier {}
|
abstract class ArcaneService with ChangeNotifier {
|
||||||
|
static T? of<T extends ArcaneService>(BuildContext context) =>
|
||||||
|
context.serviceOfType<T>();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user