import 'package:flutter/widgets.dart'; import 'app_bootstrap_controller.dart'; import 'app_dependencies.dart'; class AppScope extends InheritedWidget { const AppScope({ super.key, required this.backendConfig, required this.dependencies, required super.child, }); final BackendConfigHandle backendConfig; final AppDependencies? dependencies; static AppDependencies of(BuildContext context) { final scope = context.dependOnInheritedWidgetOfExactType(); assert(scope != null, 'AppScope is not available in this context.'); final dependencies = scope!.dependencies; assert(dependencies != null, 'AppDependencies are not available in this context.'); return dependencies!; } static BackendConfigHandle backendConfigOf(BuildContext context) { final scope = context.dependOnInheritedWidgetOfExactType(); assert(scope != null, 'AppScope is not available in this context.'); return scope!.backendConfig; } @override bool updateShouldNotify(AppScope oldWidget) { return dependencies != oldWidget.dependencies || backendConfig != oldWidget.backendConfig; } }