serialize method
String?
serialize(
{ - required bool fromIDL,
- bool nullable = false,
})
override
Implementation
@override
String? serialize({required bool fromIDL, bool nullable = false}) {
var s = child.serialize(fromIDL: fromIDL);
final isOpt = ctx.parent?.parent is OptTypeContext;
if (isOpt) {
nullable = false;
}
if (s != null && s != IDLType.ph) {
final isParentVariant = ctx.parent?.parent?.parent?.parent?.parent?.parent
is VariantTypeContext;
String call = '.map';
if (!fromIDL && isOpt && !isParentVariant) {
call = '?$call';
}
s = '${IDLType.ph}$call((e) { '
"return ${s.replaceAll(IDLType.ph, "e")};"
' }).toList()';
}
return s;
}