toString method
Use showSecond
to show seconds in your string time.
NOTE: toString does not show the day!
Implementation
@override
String toString({bool showSecond = false}) {
StringBuffer stringBuffer = StringBuffer();
stringBuffer.write(
"${hour.toString().padLeft(2, "0")}:${minute.toString().padLeft(2, "0")}");
if (showSecond) {
stringBuffer.write(":${second.toString().padLeft(2, "0")}");
}
return stringBuffer.toString();
}