commandRegistry method

CommandRegistry commandRegistry({
  1. BuildContext? context,
})

Returns the active command registry for context, or for the current focus/default test context when context is omitted.

Implementation

CommandRegistry commandRegistry({BuildContext? context}) {
  _assertNotDisposed('commandRegistry');
  final buildContext = _defaultCommandContext(context);
  final registry = buildContext == null
      ? null
      : CommandRegistryScope.maybeOf(buildContext);
  if (registry == null) {
    throw StateError(
      'FleuryTester.commandRegistry could not locate a CommandRegistryScope '
      'in the current tree.',
    );
  }
  return registry;
}