toString method

  1. @override
String toString({
  1. bool showSecond = false,
})
override

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();
}