ApplyArguments typedef

ApplyArguments = ({Map<Symbol, Object?>? namedArguments, List<Object?>? positionalArguments})

A structured container for function arguments that allows for auditing and reversals.

ApplyArguments holds the data needed to call a function. Instead of passing loose lists or maps, this type groups all inputs into a single, reliable record. This structure makes it possible for the framework to log the exact data used for every change, support "undo" logic, and delay execution during transactions.

Why it is used

  • Tracking and Auditing: It creates a permanent record of the specific data used to trigger a change, which is essential for debugging and history.
  • Transactions: It allows the framework to "save" a command and its arguments so they can be executed later as part of a larger group of changes.
  • Safety Checks: It lets the framework's integrity rules (gates) inspect the data before the function actually runs, preventing invalid state changes.

How it works

It uses a Dart record with two specific channels to mimic standard function calls:

  1. positionalArguments: A list of values passed in a specific order.
  2. namedArguments: A map of values assigned to specific names (using Symbols).

Technical Details

  • Memory Efficient: It uses a flyweight record to keep memory usage low, even when many commands are being processed at once.
  • Flexible: Both fields are optional. This allows for simple calls that don't require any arguments without adding the overhead of empty lists or maps.

See also:

  • ApplyCommand – The full package containing the function and its arguments.
  • ApplyLedger – The system that records these arguments for the audit history.

Implementation

typedef ApplyArguments = ({
  List<Object?>? positionalArguments,
  Map<Symbol, Object?>? namedArguments
});