mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
560 B
27 lines
560 B
6 years ago
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
// found in the LICENSE file.
|
||
|
|
||
|
String prettyPrintList(Iterable iter) {
|
||
|
if (iter == null) return 'NULL';
|
||
|
|
||
|
final buff = StringBuffer();
|
||
|
var isFirst = true;
|
||
|
|
||
|
buff.write('[');
|
||
|
|
||
|
for (final val in iter) {
|
||
|
if (!isFirst) buff.write(', ');
|
||
|
isFirst = false;
|
||
|
if (val is String) {
|
||
|
buff.write('"$val"');
|
||
|
} else {
|
||
|
buff.write(val.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
buff.write(']');
|
||
|
|
||
|
return buff.toString();
|
||
|
}
|