update: 37 pass 7 fail
This commit is contained in:
parent
8a932d8759
commit
8de776f5b5
1 changed files with 7 additions and 6 deletions
|
@ -83,14 +83,15 @@ class RuntimeReflector {
|
|||
|
||||
// Create instance
|
||||
try {
|
||||
// Convert named args to symbols
|
||||
final namedArgSymbols = namedArgs.map(
|
||||
(key, value) => MapEntry(Symbol(key), value),
|
||||
);
|
||||
|
||||
// Call the factory with the arguments spread out
|
||||
if (constructor.parameters.any((p) => p.isNamed)) {
|
||||
// For constructors with named parameters
|
||||
return Function.apply(
|
||||
factory,
|
||||
[],
|
||||
namedArgs.map(
|
||||
(key, value) => MapEntry(Symbol(key), value),
|
||||
));
|
||||
return Function.apply(factory, positionalArgs, namedArgSymbols);
|
||||
} else {
|
||||
// For constructors with only positional parameters
|
||||
return Function.apply(factory, positionalArgs);
|
||||
|
|
Loading…
Reference in a new issue