fromControllerName static method

AutoManagedWebF fromControllerName({
  1. Key? key,
  2. required String controllerName,
  3. String? initialRoute = '/',
  4. Map<String, dynamic>? initialState,
  5. Widget? loadingWidget,
  6. Widget errorBuilder(
    1. BuildContext context,
    2. Object? error
    )?,
  7. bool forceLoad = false,
  8. WebFBundle? bundle,
  9. ControllerFactory? createController,
  10. Map<String, SubViewBuilder>? routes,
  11. VoidCallback? onDispose,
  12. OnControllerCreated? onControllerCreated,
  13. VoidCallback? onBuildSuccess,
  14. ControllerSetup? setup,
})

Create a WebF widget using a controller name from WebFControllerManager.

This constructor will asynchronously load the controller and automatically handle recreation of disposed controllers.

If the controller doesn't exist and a bundle is provided, it will be automatically initialized with addOrUpdateWithPreload.

You can customize the loading experience with loadingWidget and handle errors with errorBuilder. The builder allows you to create custom UI with the controller.

Implementation

static AutoManagedWebF fromControllerName(
    {Key? key,
    required String controllerName,
    String? initialRoute = '/',
    Map<String, dynamic>? initialState,
    Widget? loadingWidget,
    Widget Function(BuildContext context, Object? error)? errorBuilder,
    bool forceLoad = false,
    // Parameters for auto-initialization if controller is not found
    WebFBundle? bundle,
    ControllerFactory? createController,
    Map<String, SubViewBuilder>? routes,
    VoidCallback? onDispose,
    OnControllerCreated? onControllerCreated,
    VoidCallback? onBuildSuccess,
    ControllerSetup? setup}) {
  return AutoManagedWebF(
      controllerName: controllerName,
      loadingWidget: loadingWidget,
      forceLoad: forceLoad,
      errorBuilder: errorBuilder,
      initialRoute: initialRoute,
      initialState: initialState,
      bundle: bundle,
      onDispose: onDispose,
      onControllerCreated: onControllerCreated,
      onBuildSuccess: onBuildSuccess,
      createController: createController,
      routes: routes,
      key: key,
      setup: setup);
}