in lib/src/mock.dart [1188:1232]
String toPrettyString() {
String argString;
// Add quotes around strings to clarify the type of the argument to the user
// and so the empty string is represented.
var args = positionalArguments.map((v) => v is String ? "'$v'" : '$v');
if (args.any((arg) => arg.contains('\n'))) {
// As one or more arg contains newlines, put each on its own line, and
// indent each, for better readability.
argString = '\n' +
args
.map((arg) => arg.splitMapJoin('\n', onNonMatch: (m) => ' $m'))
.join(',\n');
} else {
// A compact String should be perfect.
argString = args.join(', ');
}
if (namedArguments.isNotEmpty) {
if (argString.isNotEmpty) argString += ', ';
var namedArgs = namedArguments.keys
.map((key) => '${_symbolToString(key)}: ${namedArguments[key]}');
if (namedArgs.any((arg) => arg.contains('\n'))) {
// As one or more arg contains newlines, put each on its own line, and
// indent each, for better readability.
namedArgs = namedArgs
.map((arg) => arg.splitMapJoin('\n', onNonMatch: (m) => ' $m'));
argString += '{\n${namedArgs.join(',\n')}}';
} else {
// A compact String should be perfect.
argString += '{${namedArgs.join(', ')}}';
}
}
var method = _symbolToString(memberName);
if (isMethod) {
method = '$method($argString)';
} else if (isGetter) {
method = '$method';
} else if (isSetter) {
method = '$method=$argString';
} else {
throw StateError('Invocation should be getter, setter or a method call.');
}
return method;
}