registerFunctionTypedef method

void registerFunctionTypedef(
  1. String name,
  2. String library
)

Registers a function typedef so it can be resolved as a type.

Function typedefs like typedef VoidCallback = void Function() are not classes, but D4rt scripts may reference them as type arguments (e.g., ObserverList<VoidCallback>()). This registers the name as a BridgedClass with nativeType: Function so type resolution succeeds.

name The typedef name (e.g., 'VoidCallback'). library The library path where this typedef is exported from.

Implementation

void registerFunctionTypedef(String name, String library) {
  final typedef = (name: name, library: library);
  _functionTypedefs.add(typedef);
  // Step 7: dual-write into the process-global pool (see registerBridgedEnum).
  _bundleFor().functionTypedefs.add(typedef);
}