isAssignable property

bool Function(Object?)? isAssignable
final

A function that determines if a native value can be assigned to this bridged type.

This is used when bridging native values back to the interpreter. When a native method returns an instance of a private subclass (e.g., _Linear extends Curve), the bridge lookup by exact type will fail. This function allows the runtime to find an appropriate supertype bridge by checking isAssignable(nativeValue).

Example for Curve bridge:

BridgedClass(
  nativeType: Curve,
  isAssignable: (v) => v is Curve,
  ...
)

When Curves.linear returns a _Linear instance, the runtime will:

  1. Try exact type lookup for _Linear - fails (not registered)
  2. Iterate through registered bridges, checking isAssignable
  3. Find the Curve bridge where _Linear() is Curve returns true
  4. Wrap the _Linear instance using the Curve bridge

Implementation

final bool Function(Object?)? isAssignable;