feature top-level property

FeatureDescriptor feature
final

Implementation

final feature = FeatureDescriptor(
  name: 'system',
  title: 'System',
  description: 'The core building blocks of the framework',
  icon: Icons.hub,
  init: () async {
    // Start from the app's theme, so there is one source of truth.
    _themeService?.dispose();
    final themeService = _themeService = ThemeService.fromTheme(
      VyuhBinding.instance.widgetBuilder.theme,
    );
    VyuhBinding.instance.di.register(themeService);
    VyuhBinding.instance.di.register(BreakpointService());
  },
  // Held here, not looked up in DI: on restart the platform resets plugins
  // (DI included) before it disposes the previous features.
  dispose: () async {
    _themeService?.dispose();
    _themeService = null;
  },
  routes: () => _routes,
  extensions: [descriptor],
  extensionBuilders: [ContentExtensionBuilder()],
);