WebFControllerManagerConfig class

Configuration options for the WebFControllerManager.

This class provides settings to control how the manager handles controller lifecycle, resource limits, and notifications. Key configuration options include:

  • Maximum number of alive and attached controllers
  • Auto-disposal policy for controllers
  • Callbacks for controller lifecycle events
  • DevTools debugging support

Usage example:

// Initialize the manager (usually in your app's main() function)
void main() {
  WebFControllerManager.instance.initialize(
    WebFControllerManagerConfig(
      maxAliveInstances: 5,
      maxAttachedInstances: 3,
      enableDevTools: true, // Enable DevTools for all managed controllers
      onControllerDisposed: (name, controller) {
        print('Controller $name was disposed');
      },
      onControllerDetached: (name, controller) {
        print('Controller $name was detached');
      }
    )
  );

  // Add controllers
  await WebFControllerManager.instance.addWithPrerendering(
    name: 'home',
    createController: () => WebFController(),
    bundle: WebFBundle.fromUrl('https://example.com'),
  );

  // To use a controller with automatic lifecycle management:
  runApp(AsyncWebF(controllerName: 'home'));
}

Constructors

WebFControllerManagerConfig({int maxAliveInstances = 5, int maxAttachedInstances = 3, bool autoDisposeWhenLimitReached = true, void onControllerDisposed(String name, WebFController controller)?, void onControllerDetached(String name, WebFController controller)?, bool enableDevTools = kDebugMode, int devToolsPort = 9222, String devToolsAddress = '0.0.0.0', bool useDioForNetwork = true})
Creates a new configuration object for WebFControllerManager.
const

Properties

autoDisposeWhenLimitReached bool
Whether to automatically dispose controllers when limits are exceeded.
final
devToolsAddress String
The address to bind the DevTools server to.
final
devToolsPort int
The port number for the DevTools server.
final
enableDevTools bool
Whether to enable Chrome DevTools for all managed controllers.
final
hashCode int
The hash code for this object.
no setterinherited
maxAliveInstances int
Maximum number of WebFController instances that can be alive at the same time.
final
maxAttachedInstances int
Maximum number of WebFController instances that can be attached to Flutter at the same time.
final
onControllerDetached → void Function(String name, WebFController controller)?
Callback triggered when a controller is detached from Flutter.
final
onControllerDisposed → void Function(String name, WebFController controller)?
Callback triggered when a controller is disposed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useDioForNetwork bool
Use Dio for network requests When true, controllers route HTTP through Dio while preserving WebF's cookie and HTTP cache behavior.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited