Skip to main content
Blockly
  • Blockly
Guides Reference Tutorial
  • Codelabs
  • Samples
Summits Community Forum Accessibility
/
  • English
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어
  • Reference
Blockly
  • Blockly
  • Guides
  • Reference
  • Tutorial
    • More
  • Summits
  • Community Forum
  • Accessibility
  • Overview
  • Classes
  • Block
  • BlockFlyoutInflater
  • BlockNavigationPolicy
  • BlockSvg
  • ButtonFlyoutInflater
  • CodeGenerator
  • CollapsibleToolboxCategory
  • ComponentManager
  • Connection
  • ConnectionChecker
  • ConnectionDB
  • ConnectionNavigationPolicy
  • ContextMenuRegistry
  • DeleteArea
  • DragTarget
  • FieldCheckbox
  • FieldDropdown
  • FieldImage
  • FieldLabel
  • FieldLabelSerializable
  • FieldNavigationPolicy
  • FieldNumber
  • FieldTextInput
  • FieldVariable
  • FlyoutButton
  • FlyoutButtonNavigationPolicy
  • FlyoutItem
  • FlyoutMetricsManager
  • FlyoutNavigationPolicy
  • FlyoutNavigator
  • FlyoutSeparator
  • FlyoutSeparatorNavigationPolicy
  • FocusableTreeTraverser
  • FocusManager
  • Gesture
  • Grid
  • HorizontalFlyout
  • Input
  • InsertionMarkerPreviewer
  • LabelFlyoutInflater
  • LineCursor
  • Marker
  • MarkerManager
  • Menu
  • MenuItem
  • MetricsManager
  • Names
  • Navigator
  • Options
  • RenderedConnection
  • Scrollbar
  • ScrollbarPair
  • SeparatorFlyoutInflater
  • ShortcutRegistry
  • Theme
  • ThemeManager
  • Toast
  • Toolbox
  • ToolboxCategory
  • ToolboxItem
  • ToolboxSeparator
  • Trashcan
  • UnattachedFieldError
  • VariableMap
  • VariableModel
  • VerticalFlyout
  • Workspace
  • WorkspaceAudio
  • WorkspaceDragger
  • WorkspaceNavigationPolicy
  • WorkspaceSvg
  • ZoomControls
  • Abstract Classes
  • Field
  • Flyout
  • Enumerations
  • ConnectionType
  • Functions
  • getFocusManager()
  • hasBubble(obj)
  • hideChaff(opt_onlyClosePopups)
  • inject(container, opt_options)
  • isCopyable(obj)
  • isDeletable(obj)
  • isDraggable(obj)
  • isIcon(obj)
  • isPaster(obj)
  • isRenderedElement(obj)
  • isSelectable(obj)
  • isSerializable(obj)
  • isVariableBackedParameterModel(param)
  • setLocale(locale)
  • Interfaces
  • BlocklyOptions
  • FieldCheckboxConfig
  • FieldCheckboxFromJsonConfig
  • FieldConfig
  • FieldDropdownFromJsonConfig
  • FieldImageConfig
  • FieldImageFromJsonConfig
  • FieldLabelConfig
  • FieldLabelFromJsonConfig
  • FieldNumberConfig
  • FieldNumberFromJsonConfig
  • FieldTextInputFromJsonConfig
  • FieldVariableConfig
  • FieldVariableFromJsonConfig
  • IAutoHideable
  • IBoundedElement
  • IBubble
  • ICollapsibleToolboxItem
  • IComponent
  • IConnectionChecker
  • IConnectionPreviewer
  • IContextMenu
  • ICopyable
  • IDeletable
  • IDeleteArea
  • IDraggable
  • IDragger
  • IDragStrategy
  • IDragTarget
  • IFlyout
  • IFlyoutInflater
  • IFocusableNode
  • IFocusableTree
  • IHasBubble
  • IIcon
  • IKeyboardAccessible
  • ImageProperties
  • IMetricsManager
  • IMovable
  • INavigationPolicy
  • IPaster
  • IPositionable
  • IRegistrable
  • IRenderedElement
  • ISelectable
  • ISelectableToolboxItem
  • ISerializable
  • IStyleable
  • IToolbox
  • IToolboxItem
  • IVariableBackedParameterModel
  • IVariableMap
  • IVariableModel
  • IVariableState
  • ToastOptions
  • Namespaces
  • Block
  • blockAnimations
  • blockRendering
  • browserEvents
  • bubbles
  • bumpObjects
  • clipboard
  • CollapsibleToolboxCategory
  • comments
  • common
  • ComponentManager
  • constants
  • ContextMenu
  • ContextMenuItems
  • ContextMenuRegistry
  • Css
  • dialog
  • dragging
  • Events
  • Extensions
  • fieldRegistry
  • geras
  • icons
  • ICopyable
  • inputs
  • layers
  • libraryBlocks
  • MetricsManager
  • Names
  • Options
  • Procedures
  • registry
  • RenderedConnection
  • renderManagement
  • serialization
  • ShortcutItems
  • ShortcutRegistry
  • Theme
  • ThemeManager
  • Themes
  • thrasos
  • Toast
  • ToolboxCategory
  • ToolboxSeparator
  • Tooltip
  • Touch
  • uiPosition
  • utils
  • Variables
  • VariablesDynamic
  • WidgetDiv
  • Xml
  • zelos
  • Variables
  • Blocks
  • COLLAPSE_CHARS
  • COLLAPSED_FIELD_NAME
  • COLLAPSED_INPUT_NAME
  • config
  • defineBlocksWithJsonArray
  • DELETE_VARIABLE_ID
  • DropDownDiv
  • getMainWorkspace
  • getSelected
  • INPUT_VALUE
  • JavaScript
  • Msg
  • NEXT_STATEMENT
  • OPPOSITE_TYPE
  • OUTPUT_VALUE
  • PREVIOUS_STATEMENT
  • PROCEDURE_CATEGORY_NAME
  • RENAME_VARIABLE_ID
  • setParentContainer
  • svgResize
  • TOOLBOX_AT_BOTTOM
  • TOOLBOX_AT_LEFT
  • TOOLBOX_AT_RIGHT
  • TOOLBOX_AT_TOP
  • VARIABLE_CATEGORY_NAME
  • VARIABLE_DYNAMIC_CATEGORY_NAME
  • VERSION
  • Type Aliases
  • FieldCheckboxValidator
  • FieldDropdownConfig
  • FieldDropdownValidator
  • FieldNumberValidator
  • FieldTextInputConfig
  • FieldTextInputValidator
  • FieldValidator
  • FieldVariableValidator
  • ICopyData
  • MenuGenerator
  • MenuGeneratorFunction
  • MenuOption
  • ReturnEphemeralFocus
  • Codelabs
  • Samples
  • Home
  • Products
  • Google for Education
  • Blockly
  • Reference

blockly > IVariableModel

IVariableModel interface

Signature:

export interface IVariableModel<T extends IVariableState> 

Methods

Method Description
getId()
getName()
getType() Returns the type of the variable like 'int' or 'string'. Does not need to be unique. This will default to '' which is a specific type.
getWorkspace()
save()
setName(name)
setType(type)

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 2025-05-16 UTC.

  • Programs

    • Google Developer Groups
    • Google Developer Experts
    • Accelerators
    • Women Techmakers
  • 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
  • ICP证合字B2-20070004号
  • Manage cookies
  • Sign up for the Google Developers newsletter Subscribe
  • English
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어