FlowMindFieldRegistry class

Opt-in registry that maps a human-readable key (typically the field's hint or labelText) to its TextEditingController.

Why this exists: Material's TextFormField produces multiple Semantics layers carrying the same label, and SemanticsAction.setText can route through whichever field has keyboard focus — leading to text landing in the wrong controller. By registering controllers directly, the bridge can write text by direct reference, bypassing semantics entirely.

Usage in your text field widget:

@override
void initState() {
  super.initState();
  assert(() {
    FlowMindFieldRegistry.register(widget.hintText, widget.controller);
    return true;
  }());
}

@override
void dispose() {
  assert(() {
    FlowMindFieldRegistry.unregister(widget.hintText);
    return true;
  }());
  super.dispose();
}

The assert(() { ... ; return true; }()) pattern keeps registry calls in debug builds only — the same convention the bridge itself uses, so nothing leaks into release/profile binaries.

Constructors

FlowMindFieldRegistry()

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 Methods

clear() → void
Clear every registered field — primarily for hot-restart scenarios.
lookup(String? key) TextEditingController?
Find a controller by exact match, then case-insensitive, then by the slugified element-ID prefix (hint_<nodeId>-style ids). Returns null if no field is registered under any matching key.
register(String? key, TextEditingController controller) → void
Register a controller under key. If key already exists the new controller replaces the old one — handy for screens that rebuild but keep the same logical field name.
registeredKeys() List<String>
Used by tests / diagnostics.
unregister(String? key, [TextEditingController? owner]) → void
Drop a key from the registry — but ONLY if the controller currently stored under key is the same one owner passed in (or owner is null, for legacy callers).