nearestScopeId static method
Returns the nearest ancestor scope's focus ID.
This is used by widgets like TextField that need to register
in the focus tree for trap ancestry checks but live outside
focus.dart and cannot access private state types.
Implementation
static String? nearestScopeId(BuildContext context) {
final state = context.findAncestorStateOfType<_FocusScopeState>();
return state?._focusId;
}