nyStateNameForWidget function

String nyStateNameForWidget(
  1. String widgetTypeName
)

The state name a page listens on, built from the page's widget class.

e.g. MyPage -> Closure: () => _MyPageState

Every state name in the framework resolves through this function, so the listening end (NyPage, NyState) and the sending end (RouteViewExt.stateName, updateState with a RouteView, StateAction) always build the same string from the same class.

The widget class is the anchor because it is the only class both ends can see: a sender holds a RouteView, which knows the widget it builds and nothing about the state behind it. Reading one class on one end and a different class on the other end only agrees while class names survive - flutter build --obfuscate renames a widget and its state to two unrelated symbols, which is why both ends now read the widget.

Implementation

String nyStateNameForWidget(String widgetTypeName) =>
    "Closure: ${nyStateSignatureForWidget(widgetTypeName)}";