toSqlString method
Formats this value as a SQL-compatible time literal with scale precision.
Implementation
String toSqlString({int scale = 7}) {
_checkRange(scale, 0, 7, 'scale');
final rounded = roundedToScale(scale);
final base =
'${rounded.hour.toString().padLeft(2, '0')}:'
'${rounded.minute.toString().padLeft(2, '0')}:'
'${rounded.second.toString().padLeft(2, '0')}';
if (scale == 0) {
return base;
}
final fraction = rounded.fractionTicks.toString().padLeft(7, '0');
return '$base.${fraction.substring(0, scale)}';
}