toYaml method
Implementation
String toYaml(String indent, {required bool phasesAreTests}) {
final result = StringBuffer();
result.writeln('$indent$type:');
if (phase != null) {
final fieldName = phasesAreTests ? 'test' : 'phase';
result.writeln('$indent $fieldName: $phase');
}
result.writeln('$indent identityHashCode: $code');
final theContext = context;
if (theContext != null && theContext.isNotEmpty) {
result.writeln('$indent context:');
final contextIndent = '$indent ';
result.write(
theContext.keys.map((key) {
final value = _toMultiLineYamlString(
contextToString(theContext[key]),
' $contextIndent',
);
return '$contextIndent$key: $value\n';
}).join(),
);
}
if (detailedPath != null) {
result.writeln('$indent retainingPath:');
result.writeln(detailedPath!.map((s) => '$indent - $s').join('\n'));
} else if (retainingPath != null) {
result.writeln('$indent retainingPath: $retainingPath');
}
return result.toString();
}