Environment class

Constructors

Environment.new([Map<String, dynamic> data = const {}, Map<String, dynamic>? register, bool strictMode = false])
Constructs a new Environment instance with the provided initial data.
Environment.withStrictMode([Map<String, dynamic> data = const {}, Map<String, dynamic>? register])

Properties

hashCode int
The hash code for this object.
no setterinherited
registers Map<String, dynamic>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strictMode bool
Gets the current strict mode setting.
no setter

Methods

all() Map<String, dynamic>
Returns a map containing all variables in the current context.
call(String key) → dynamic
clear() → void
Clears the variable stack and adds a new global scope.
clone() Environment
Creates a new Environment instance that is a deep copy of the current instance.
getAvailableFilters() List<String>
Returns a list of all available filter names (local + global unless in strict mode).
getAvailableTags() List<String>
Returns a list of all available tag names (local + global unless in strict mode).
getFilter(String name) → FilterFunction?
Gets the filter function registered with the given name.
getRegister(String key) → dynamic
getRoot() Root?
getTag(String name) TagCreator?
Gets a tag creator function, checking local registrations first, then global.
getVariable(String name) → dynamic
Retrieves the value of a variable from the current scope or any parent scopes.
merge(Map<String, dynamic> newData) → void
Merges new data into the current scope.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
popScope() → void
Removes the most recently added scope from the variable stack.
pushScope() → void
Pushes a new scope onto the variable stack.
registerFilter(String name, FilterFunction function) → void
Registers a new filter function with the given name.
registerLocalFilter(String name, FilterFunction function) → void
Registers a local filter function that is only available in this environment.
registerLocalTag(String name, TagCreator creator) → void
Registers a local tag creator function that is only available in this environment.
removeRegister(String s) → void
setRegister(String key, dynamic value) → void
setRoot(Root? root) → void
setStrictMode(bool strict) → void
Sets strict mode for the environment. When strict mode is enabled, only locally registered filters and tags are accessible. Global registries are ignored in strict mode.
setVariable(String name, dynamic value) → void
Sets a variable in the current scope.
toString() String
A string representation of this object.
inherited

Operators

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