INNER CODE UNIT · Dart
_reconstituteNamedArgs
felangel/mocktail · packages/mocktail/lib/src/_is_invocation.dart:171
static Map<Symbol, dynamic> _reconstituteNamedArgs(Invocation invocation) {
final namedArguments = <Symbol, dynamic>{};
final storedNamedArgSymbols = _storedNamedArgs.keys.map(
(name) => Symbol(name),
);
// Iterate through [invocation]'s named args, validate them, and add them
// to the return map.
invocation.namedArguments.forEach((name, dynamic arg) {
if (arg == null) {
if (!storedNamedArgSymbols.contains(name)) {
// Either this is a parameter with default value `null`, or a `null`
// argument was passed, or an unnamed ArgMatcher was used. Just use
// `null`.
namedArguments[name] = null;
}
} else {
// Add each real named argument (not wrapped in an ArgMatcher).