Environment constructor

Environment([
  1. Map<String, dynamic> data = const {},
  2. Map<String, dynamic>? register,
  3. bool strictMode = false,
  4. LiquidConfig? config,
])

Constructs a new Environment instance with the provided initial data.

The Environment class manages the variable stack and filters used within a code context. This constructor initializes the variable stack with the given data map, which represents the initial variables and their values.

Parameters:

  • data: An optional map of initial variables and their values. Defaults to an empty map.
  • register: An optional map of initial register values. Defaults to an empty map.
  • strictMode: When true, only locally registered filters and tags are accessible. Defaults to false.
  • config: Optional LiquidConfig for custom delimiters. Used by tags that re-parse content.

Implementation

Environment([
  Map<String, dynamic> data = const {},
  Map<String, dynamic>? register,
  bool strictMode = false,
  LiquidConfig? config,
]) : _variableStack = [data],
     _registers = register ?? {},
     _strictMode = strictMode,
     _config = config;