2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-03 17:58:21 +00:00

Dont make a param optional if it already is

This commit is contained in:
Mohammed Salman
2022-01-21 23:12:18 +03:00
parent f998dc01d6
commit 32df06dc44

View File

@@ -355,14 +355,13 @@ class TemplateGenerator {
if (f.arguments.isNotEmpty && namedArgs) {
rt.write("{");
}
final typeSuffix = namedArgs ? "?" : "";
rt.write(f.arguments
.map((x) =>
getTypeName(template, x.type, templates, true) +
typeSuffix +
rt.write(f.arguments.map((x) {
final typeName = getTypeName(template, x.type, templates, true);
return typeName +
(namedArgs && !typeName.endsWith("?") ? "?" : "") +
" " +
x.name)
.join(","));
x.name;
}).join(","));
if (f.arguments.isNotEmpty && namedArgs) {
rt.write("}");
}