toString method
override
A string representation of this object.
Some classes have a default textual representation,
often paired with a static parse
function (like int.parse).
These classes will provide the textual representation as
their string representation.
Other classes have no meaningful textual representation
that a program will care about.
Such classes will typically override toString
to provide
useful information when inspecting the object,
mainly for debugging or logging.
Implementation
@override
String toString() {
// 分数と秒数を計算
int beginMinutes = (_timeStampBegin / 60).floor();
int beginSeconds = _timeStampBegin.toInt() % 60;
int endMinutes = (_timeStampEnd / 60).floor();
int endSeconds = _timeStampEnd.toInt() % 60;
// 文字列としてフォーマット
String beginTimeString =
'$beginMinutes:${beginSeconds.toString().padLeft(2, '0')}';
String endTimeString =
'$endMinutes:${endSeconds.toString().padLeft(2, '0')}';
return 'Text: $_text\n'
'Person ID: $_personId\n'
'Confidence: $_confidence\n'
'Time Stamp (Begin): $beginTimeString\n'
'Time Stamp (End): $endTimeString';
}