ArgumentValueHolder constructor
ArgumentValueHolder({})
Argument Value Holder
Represents a structured container for arguments (both positional and named) passed to constructors, methods, or functions within the dependency injection / reflection framework.
Purpose
- Provides a unified abstraction for storing arguments in different forms:
- namedArgs → explicitly named parameters.
- positionalArgs → standard ordered arguments.
- arguments → a normalized representation as ArgumentValue objects.
- Useful when invoking executables (constructors/methods) reflectively, allowing consistent handling of parameter passing regardless of origin.
Behavior
- Defaults to empty argument sets if none are provided.
- Immutable references to the provided maps/lists ensure predictable argument evaluation.
- Can be extended to carry additional metadata (see ExecutableHolder).
Example
final args = ArgumentValueHolder(
namedArgs: {'timeout': 30},
positionalArgs: ['db_connection'],
arguments: [ArgumentValue.named('timeout', 30)],
);
print(args.namedArgs['timeout']); // 30
print(args.positionalArgs.first); // "db_connection"
print(args.arguments.first.name); // "timeout"
Notes
- Serves as the base class for ExecutableHolder.
- Primarily used internally when resolving or invoking pods.
Implementation
ArgumentValueHolder({
this.namedArgs = const {},
this.positionalArgs = const [],
this.arguments = const [],
});