runApp function

void runApp({
  1. required FeaturesBuilder features,
  2. PluginDescriptor? plugins,
  3. PlatformWidgetBuilder? platformWidgetBuilder,
  4. 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 Features object. This object configures the features available in the app.
  • plugins: Optional. A PluginDescriptor object that specifies the plugins to be used. If not provided, defaults to PluginDescriptor.defaultPlugins.
  • 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,
  PluginDescriptor? plugins,
  PlatformWidgetBuilder? platformWidgetBuilder,
  String? initialLocation,
}) async {
  WidgetsFlutterBinding.ensureInitialized();

  final widgetBuilder = platformWidgetBuilder ?? defaultPlatformWidgetBuilder;

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

  vyuh.run();
}