• Blockly
  • English
  • Bahasa Indonesia
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어
Sign in
Home Guides Reference Samples Codelabs Get Help Summits Publications
  • Blockly
  • Home
  • Guides
  • Reference
  • Samples
  • Codelabs
  • Get Help
  • Summits
  • Publications
  • Overview
  • Classes
  • ASTNode
  • BasicCursor
  • Block
  • BlockDragger
  • BlockDragSurfaceSvg
  • BlockSvg
  • Bubble
  • BubbleDragger
  • CodeGenerator
  • CollapsibleToolboxCategory
  • Comment
  • ComponentManager
  • Connection
  • ConnectionChecker
  • ConnectionDB
  • ContextMenuRegistry
  • Cursor
  • DeleteArea
  • DragTarget
  • Field
  • FieldAngle
  • FieldCheckbox
  • FieldColour
  • FieldDropdown
  • FieldImage
  • FieldLabel
  • FieldLabelSerializable
  • FieldMultilineInput
  • FieldNumber
  • FieldTextInput
  • FieldVariable
  • Flyout
  • FlyoutButton
  • FlyoutMetricsManager
  • Gesture
  • Grid
  • HorizontalFlyout
  • Icon
  • Input
  • InsertionMarkerManager
  • Marker
  • MarkerManager
  • Menu
  • MenuItem
  • MetricsManager
  • Mutator
  • Names
  • Options
  • RenderedConnection
  • Scrollbar
  • ScrollbarPair
  • ShortcutRegistry
  • TabNavigateCursor
  • Theme
  • ThemeManager
  • Toolbox
  • ToolboxCategory
  • ToolboxItem
  • ToolboxSeparator
  • Trashcan
  • VariableMap
  • VariableModel
  • VerticalFlyout
  • Warning
  • Workspace
  • WorkspaceAudio
  • WorkspaceComment
  • WorkspaceCommentSvg
  • WorkspaceDragger
  • WorkspaceDragSurfaceSvg
  • WorkspaceSvg
  • ZoomControls
  • Enumerations
  • ConnectionType
  • inputTypes
  • Functions
  • bindEvent_(node, name, thisObject, func)
  • bindEventWithChecks_(node, name, thisObject, func, opt_noCaptureIdentifier, _opt_noPreventDefault)
  • copy(toCopy)
  • duplicate(toDuplicate)
  • hideChaff(opt_onlyClosePopups)
  • hueToHex(hue)
  • inject(container, opt_options)
  • isNumber(str)
  • paste()
  • unbindEvent_(bindData)
  • Interfaces
  • BlocklyOptions
  • IASTNodeLocation
  • IASTNodeLocationSvg
  • IASTNodeLocationWithBlock
  • IAutoHideable
  • IBlockDragger
  • IBoundedElement
  • IBubble
  • ICollapsibleToolboxItem
  • IComponent
  • IConnectionChecker
  • IContextMenu
  • ICopyable
  • IDeletable
  • IDeleteArea
  • IDraggable
  • IDragTarget
  • IFlyout
  • IKeyboardAccessible
  • IMetricsManager
  • IMovable
  • IPositionable
  • IRegistrable
  • ISelectable
  • ISelectableToolboxItem
  • IStyleable
  • IToolbox
  • IToolboxItem
  • Namespaces
  • ASTNode
  • Block
  • blockAnimations
  • blockRendering
  • browserEvents
  • bumpObjects
  • clipboard
  • CollapsibleToolboxCategory
  • common
  • ComponentManager
  • constants
  • ContextMenu
  • ContextMenuItems
  • ContextMenuRegistry
  • Css
  • dialog
  • Events
  • Extensions
  • fieldRegistry
  • geras
  • ICopyable
  • Input
  • InsertionMarkerManager
  • libraryBlocks
  • MetricsManager
  • minimalist
  • Names
  • Options
  • Procedures
  • registry
  • RenderedConnection
  • serialization
  • ShortcutItems
  • ShortcutRegistry
  • Theme
  • ThemeManager
  • Themes
  • thrasos
  • ToolboxCategory
  • ToolboxSeparator
  • Tooltip
  • Touch
  • uiPosition
  • utils
  • Variables
  • VariablesDynamic
  • WidgetDiv
  • Xml
  • zelos
  • Variables
  • ALIGN_CENTRE
  • ALIGN_LEFT
  • ALIGN_RIGHT
  • Blocks
  • COLLAPSE_CHARS
  • COLLAPSED_FIELD_NAME
  • COLLAPSED_INPUT_NAME
  • config
  • connectionTypes
  • defineBlocksWithJsonArray
  • DELETE_VARIABLE_ID
  • DRAG_STACK
  • DropDownDiv
  • DUMMY_INPUT
  • getMainWorkspace
  • getSelected
  • INPUT_VALUE
  • JavaScript
  • Msg
  • NEXT_STATEMENT
  • OPPOSITE_TYPE
  • OUTPUT_VALUE
  • PREVIOUS_STATEMENT
  • PROCEDURE_CATEGORY_NAME
  • RENAME_VARIABLE_ID
  • resizeSvgContents
  • setLocale
  • setParentContainer
  • svgResize
  • TOOLBOX_AT_BOTTOM
  • TOOLBOX_AT_LEFT
  • TOOLBOX_AT_RIGHT
  • TOOLBOX_AT_TOP
  • VARIABLE_CATEGORY_NAME
  • VARIABLE_DYNAMIC_CATEGORY_NAME
  • VERSION
  • Type Aliases
  • FieldAngleValidator
  • FieldCheckboxValidator
  • FieldColourValidator
  • FieldDropdownValidator
  • FieldMultilineInputValidator
  • FieldNumberValidator
  • FieldTextInputValidator
  • FieldValidator
  • FieldVariableValidator
  • MenuGenerator
  • MenuGeneratorFunction
  • MenuOption
  • Home
  • Products
  • Google for Education
  • Blockly
  • Reference
Stay organized with collections Save and categorize content based on your preferences.

blockly > VariableMap > getVariableById

VariableMap.getVariableById() method

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

Signature:

getVariableById(id: string): VariableModel | null;

Parameters

Parameter Type Description
id string The ID to check for.

Returns:

VariableModel | null

The variable with the given ID.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-10-04 UTC.

  • Connect

    • Blog
    • Facebook
    • Medium
    • Twitter
    • YouTube
  • Programs

    • Women Techmakers
    • Google Developer Groups
    • Google Developers Experts
    • Accelerators
    • Google Developer Student Clubs
  • Developer consoles

    • Google API Console
    • Google Cloud Platform Console
    • Google Play Console
    • Firebase Console
    • Actions on Google Console
    • Cast SDK Developer Console
    • Chrome Web Store Dashboard
Google Developers
  • Android
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Terms
  • Privacy
  • Sign up for the Google Developers newsletter Subscribe
  • English
  • Bahasa Indonesia
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어