toMapString method
Implementation
@override
String toMapString() {
switch (dbType) {
case DbType.bool:
return 'if ($fieldName != null) {map[\'$fieldName\'] = forQuery? ($fieldName ! ? 1 : 0) : $fieldName;} else if ($fieldName != null || !forView){map[\'$fieldName\'] = null;}';
case DbType.date:
return 'if ($fieldName != null) {map[\'$fieldName\'] = forJson ? \'\$$fieldName!.year-\$$fieldName!.month-\$$fieldName!.day\' : forQuery? DateTime($fieldName!.year,$fieldName!.month, $fieldName!.day).millisecondsSinceEpoch : $fieldName;} else if ($fieldName != null || !forView){map[\'$fieldName\'] = null;}';
case DbType.datetime:
return 'if ($fieldName != null) {map[\'$fieldName\'] = forJson ? $fieldName!.toString(): forQuery? $fieldName!.millisecondsSinceEpoch : $fieldName;} else if ($fieldName != null || !forView){map[\'$fieldName\'] = null;}';
case DbType.datetimeUtc:
return 'if ($fieldName != null) {map[\'$fieldName\'] = forJson ? $fieldName!.toUtc().toString(): forQuery? $fieldName!.millisecondsSinceEpoch : $fieldName;} else if ($fieldName != null || !forView){map[\'$fieldName\'] = null;}';
case DbType.time:
return 'if ($fieldName != null) {map[\'$fieldName\'] = \'\${$fieldName!.hour.toString().padLeft(2, \'0\')}:\${$fieldName!.minute.toString().padLeft(2, \'0\')}:00\';} else if ($fieldName != null || !forView){map[\'$fieldName\'] = null;}';
default:
{
return 'if ($fieldName != null || !forView) { map[\'$fieldName\'] = $fieldName; }';
}
}
}