runApp function

void runApp({
  1. required FeaturesBuilder features,
  2. LazyFeaturesBuilder? lazyFeatures,
  3. PluginDescriptor? plugins,
  4. PlatformWidgetBuilder? platformWidgetBuilder,
  5. String? initialLocation,
})

The main entry point to kick off the Vyuh Application. This function should be called from the main function of the application. It initializes the Vyuh Platform and runs the application with given features and plugins.

  • features: A builder function that returns a list of FeatureDescriptor objects. These are loaded eagerly at startup.
  • lazyFeatures: Optional. A builder function that returns a list of LazyFeatureDescriptor objects. These are loaded on-demand when their routes are first navigated to, enabling web code splitting via Dart's deferred as imports.
  • plugins: Optional. A PluginDescriptor object that specifies the plugins to be used. If not provided, defaults to PluginDescriptor.system.
  • platformWidgetBuilder: Optional. A builder function that returns a platform-specific widget. If not provided, defaults to defaultPlatformWidgetBuilder.
  • initialLocation: Optional. The initial location to open in the app.

Implementation

void runApp({
  required FeaturesBuilder features,
  LazyFeaturesBuilder? lazyFeatures,
  PluginDescriptor? plugins,
  PlatformWidgetBuilder? platformWidgetBuilder,
  String? initialLocation,
}) async {
  WidgetsFlutterBinding.ensureInitialized();

  final widgetBuilder = platformWidgetBuilder ?? PlatformWidgetBuilder.system;

  vyuh = _DefaultVyuhPlatform(
    featuresBuilder: features,
    lazyFeaturesBuilder: lazyFeatures,
    pluginDescriptor: plugins ?? PluginDescriptor.system,
    widgetBuilder: widgetBuilder,
    initialLocation: initialLocation,
  );

  vyuh.run();
}