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
|
// Create instance
|
||||||
try {
|
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)) {
|
if (constructor.parameters.any((p) => p.isNamed)) {
|
||||||
// For constructors with named parameters
|
// For constructors with named parameters
|
||||||
return Function.apply(
|
return Function.apply(factory, positionalArgs, namedArgSymbols);
|
||||||
factory,
|
|
||||||
[],
|
|
||||||
namedArgs.map(
|
|
||||||
(key, value) => MapEntry(Symbol(key), value),
|
|
||||||
));
|
|
||||||
} else {
|
} else {
|
||||||
// For constructors with only positional parameters
|
// For constructors with only positional parameters
|
||||||
return Function.apply(factory, positionalArgs);
|
return Function.apply(factory, positionalArgs);
|
||||||
|
|
Loading…
Reference in a new issue