view method

  1. @override
String view()
override

Returns the view of the stopwatch.

By default returns the elapsed time formatted as MM:SS.ss Override this method or use a custom formatter for different display.

Implementation

@override
String view() {
  final minutes = _elapsed.inMinutes;
  final seconds = _elapsed.inSeconds % 60;
  final centiseconds = (_elapsed.inMilliseconds ~/ 10) % 100;
  return '${minutes.toString().padLeft(2, '0')}:'
      '${seconds.toString().padLeft(2, '0')}.'
      '${centiseconds.toString().padLeft(2, '0')}';
}