writeArguments method
Implementation
void writeArguments(StringBuffer buffer) {
String readAndMap(MoorColumn column) {
final columnName = column.name.name;
final rawData = "data['\${effectivePrefix}$columnName']";
final sqlType = 'const ${sqlTypes[column.type]}()';
var loadType = '$sqlType.mapFromDatabaseResponse($rawData)';
// run the loaded expression though the custom converter for the final
// result.
if (column.typeConverter != null) {
// stored as a static field
final converter = column.typeConverter!;
final loaded =
'${converter.table!.entityInfoName}.${converter.fieldName}';
loadType = '$loaded.mapToDart($loadType)';
}
final nullableDartType =
column.typeConverter != null && moorOptions.nullAwareTypeConverters
? column.typeConverter!.hasNullableDartType
: column.nullable;
if (!nullableDartType && options.nnbd) {
loadType += '!';
}
return loadType;
}
buffer.write('(');
for (final column in positional) {
buffer
..write(readAndMap(column))
..write(', ');
}
named.forEach((column, parameterName) {
final getter = column.dartGetterName;
buffer.write('$getter: ${readAndMap(column)}, ');
});
buffer.write(')');
}