prefer_const_declarations on local variables (#14358)
This commit is contained in:
committed by
GitHub
parent
b0e17949aa
commit
841d5d7bd5
@@ -32,7 +32,7 @@ void reportToStringError(String name, String route, int lineNumber, List<String>
|
||||
// If you're on line 12, then it has index 11.
|
||||
// If you want 1 line before and 1 line after, then you want lines with index 10, 11, and 12.
|
||||
// That's (lineNumber-1)-margin .. (lineNumber-1)+margin, or lineNumber-(margin+1) .. lineNumber+(margin-1)
|
||||
final int margin = 5;
|
||||
const int margin = 5;
|
||||
final int firstLine = math.max(0, lineNumber - margin);
|
||||
final int lastLine = math.min(lines.length, lineNumber + margin);
|
||||
print('$name : $route : line $lineNumber of ${lines.length} : $message; nearby lines were:\n ${lines.sublist(firstLine, lastLine).join("\n ")}');
|
||||
|
||||
Reference in New Issue
Block a user