nameOf static method
The name playbook runs by: its key in the registered playbooks,
otherwise its own Playbook.name, otherwise its class name in snake
case without Playbook (SignUpPlaybook is sign_up).
Implementation
static String nameOf(Playbook playbook) {
for (final MapEntry<String, Playbook Function()> entry
in playbooks.entries) {
if (entry.value().runtimeType == playbook.runtimeType) return entry.key;
}
final String? own = playbook.name?.trim();
if (own != null && own.isNotEmpty) return own;
return nameFromClass(playbook.runtimeType.toString());
}