JsExecutorRegistry class

Registry for JavaScript executor instances

Provides centralized management of JavaScript executor configuration. Replaces the old global _jsExecutorInstance pattern with a cleaner registry-based approach.

Usage

Registration

Register a JS executor once at application startup:

import 'package:web_query/js.dart';

void main() {
  // Register the executor
  JsExecutorRegistry.register(FlutterJsExecutor());

  // Now jseval transforms will work
  runApp(MyApp());
}

Checking Configuration

if (JsExecutorRegistry.isConfigured) {
  print('JS executor is ready');
} else {
  print('JS executor not configured');
}

Testing

Clear the executor between tests:

tearDown(() {
  JsExecutorRegistry.clear();
});

Migration from Old API

The old global pattern has been replaced:

// Old (deprecated)
setJsExecutorInstance(FlutterJsExecutor());

// New (preferred)
JsExecutorRegistry.register(FlutterJsExecutor());

The old setJsExecutorInstance() function still works but is deprecated.

Thread Safety

This registry uses a static field and is not thread-safe. Register the executor once during application initialization before any concurrent access.

Constructors

JsExecutorRegistry()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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

Static Properties

instance → dynamic
Get the registered JavaScript executor instance
no setter
isConfigured bool
Check if a JavaScript executor is configured
no setter

Static Methods

clear() → void
Clear the registered executor (mainly for testing)
register(dynamic executor) → void
Register a JavaScript executor instance