Last active
January 1, 2023 19:40
-
-
Save micimize/67e428dca235e26b84c193d403a6b643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void printKwargs({ | |
String string = 'default', | |
bool boolean = false, | |
int integer = 1, | |
}) { | |
print([string, boolean, integer]); | |
} | |
Map<Symbol, dynamic> symbolizeKeys(Map<String, dynamic> map) => | |
map.map((key, value) => MapEntry(Symbol(key), value)); | |
void main() { | |
final a = { | |
'integer': 10, | |
'string': 'non-default string', | |
}; | |
Function.apply(printKwargs, [], symbolizeKeys(a)); | |
} |
@hurelhuyag I would guess so if tear-off constructors have been implemented in the language, but I haven't done much with dart in a while.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you pass a constructor to
Function.apply()
?