registerCommand method

  1. @override
void registerCommand(
  1. String commandName,
  2. CommandHandler handler
)
override

Register a command handler scoped to the current block type.

Implementation

@override
void registerCommand(String commandName, CommandHandler handler) {
  if (_currentBlockTypeRegistration == null) {
    throw StateError(
      'registerCommand can only be called from within BlockHandler.registerScopedCommands',
    );
  }

  _context.blockScopedCommandHandlers.putIfAbsent(
    _currentBlockTypeRegistration!,
    () => {},
  )[commandName] = handler;
}