1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

Adding JSON example. (#1)

This commit is contained in:
Andrew Brogdon
2018-06-27 15:03:58 -07:00
committed by GitHub
parent 05319d3e8c
commit f0fe2289e6
76 changed files with 3487 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// 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();
}