blockly > Workspace > getVariableById

Workspace.getVariableById() method

v12: use Blockly.Workspace.getVariableMap().getVariableById.

Find the variable by the given ID and return it. Return null if not found.

Signature:

getVariableById(id: string): IVariableModel<IVariableState> | null;

Parameters

Parameter Type Description
id string The ID to check for.

Returns:

IVariableModel<IVariableState> | null

The variable with the given ID.