setCurrentForGeneratedCode static method

void setCurrentForGeneratedCode(
  1. IsolateIdentity identity
)

Framework plumbing — called by generated code, not by app authors.

The generated server file calls this once per isolate, before anything the app wrote gets to run. Calling it from application code means lying about which isolate you are in, and whatever reads current to name itself will believe you.

Deliberately a method rather than a settable current: the name is the warning, and IsolateIdentity.current = ... would read like something an app is meant to do.

Implementation

// ignore: use_setters_to_change_properties
static void setCurrentForGeneratedCode(IsolateIdentity identity) {
  _current = identity;
}