Context class

Context object that holds processing state and configuration.

Constructors

Context({Context? parentContext, ErrorHandler? errorHandler})
Create a new processing context.

Properties

blockHandlers Map<String, BlockHandler>
Registry of custom block handlers.
final
blockRegistry Map<String, Map<String?, Map<String, dynamic>>>
Registry of processed block properties, keyed by (blockType, identifier).
final
blockScopedBlockHandlers Map<String, Map<String, BlockHandler>>
Registry of block handlers scoped to a parent block type. Outer key = parent block type, inner key = child block type.
final
blockScopedCommandHandlers Map<String, Map<String, CommandHandler>>
final
commandHandlers Map<String, CommandHandler>
Registry of custom command handlers.
final
currentBlockType String?
Current block type being processed (null if at global scope).
getter/setter pair
currentState ProcessorState?
Current processing state.
getter/setter pair
errorHandler ErrorHandler?
Error handler for processing errors.
getter/setter pair
globalContext Context
Get the global context (root of the context chain).
no setter
hashCode int
The hash code for this object.
no setterinherited
options Map<String, dynamic>
Processing options and flags.
final
parentContext Context?
Parent context for scoping (null for global context).
final
reportUnresolvedBlockReferences bool
If true, report warnings for unresolved block references.
getter/setter pair
reportUnresolvedVariables bool
If true, report warnings for unresolved variable references.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
variables Map<String, dynamic>
Variables defined during processing (e.g., from 'set' commands). Values can be String, List&ltString&gt, or other dynamic types.
final

Methods

expandVariables(String text) String
Expand variables in a string, searching up the context chain.
getVariable(String name) → dynamic
Get a variable value, searching up the context chain. Returns the raw value (String, List<String>, etc.).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushContext() Context
Push a new context onto the stack (e.g., when entering a block). This creates a child context that has access to parent variables.
registerBlock(String blockType, String? identifier, Map<String, dynamic> properties) → void
Register a processed block and its properties.
reportError(String message, {SourceSpan? span}) → void
Report an error through the error handler with optional source span.
resolveBlockReference(BlockReference ref) String
Resolve a BlockReference against the block registry. Returns the property value as a string, or empty string if unresolved.
setVariable(String name, dynamic value) → void
Set a variable value in the current scope. Value can be String, List<String>, or other dynamic types.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited