Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: lib/src/utils.dart

Issue 1830053002: Fix all strong mode warnings. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/trace.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// The line used in the string representation of stack chains to represent 5 /// The line used in the string representation of stack chains to represent
6 /// the gap between traces. 6 /// the gap between traces.
7 const chainGap = '===== asynchronous gap ===========================\n'; 7 const chainGap = '===== asynchronous gap ===========================\n';
8 8
9 /// Returns [string] with enough spaces added to the end to make it [length] 9 /// Returns [string] with enough spaces added to the end to make it [length]
10 /// characters long. 10 /// characters long.
11 String padRight(String string, int length) { 11 String padRight(String string, int length) {
12 if (string.length >= length) return string; 12 if (string.length >= length) return string;
13 13
14 var result = new StringBuffer(); 14 var result = new StringBuffer();
15 result.write(string); 15 result.write(string);
16 for (var i = 0; i < length - string.length; i++) { 16 for (var i = 0; i < length - string.length; i++) {
17 result.write(' '); 17 result.write(' ');
18 } 18 }
19 19
20 return result.toString(); 20 return result.toString();
21 } 21 }
22
23 /// Flattens nested lists inside an iterable into a single list containing only
24 /// non-list elements.
25 List flatten(Iterable nested) {
26 var result = [];
27 helper(list) {
28 for (var element in list) {
29 if (element is List) {
30 helper(element);
31 } else {
32 result.add(element);
33 }
34 }
35 }
36 helper(nested);
37 return result;
38 }
OLDNEW
« no previous file with comments | « lib/src/trace.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698