Dumping Sequence topic
Dumps any object in Dart
that implements Iterable
.
Flow Sequences
Flow sequences start with [
and terminate with ]
. All entries are always dumped on a new line. The default scalar style for flow sequences is ScalarStyle.doubleQuoted
.
dumpSequence(
['hello', 24, true, 24.0],
collectionNodeStyle: NodeStyle.flow,
);
# Output in yaml
[
"hello",
"24",
"true",
"24.0"
]
Block Sequences
Block sequences have no explicit starting or terminating indicators. However, entries always have a leading -
. The default scalar style for block sequences is ScalarStyle.literal
.
dumpSequence(
['hello', 24, true, 24.0],
collectionNodeStyle: NodeStyle.block,
);
# Output in yaml
- |-
hello
- |-
24
- |-
true
- |-
24.0
You can still override the ScalarStyle
by providing a preferredScalarStyle
.
dumpSequence(
['hello', 24, true, 24.0],
collectionNodeStyle: NodeStyle.block,
);
# Output in yaml
- hello
- 24
- true
- 24.0
Functions
-
dumpSequence<
L extends Iterable> (L sequence, {int indent = 0, bool jsonCompatible = false, NodeStyle? collectionNodeStyle, ScalarStyle? preferredScalarStyle}) → String Dumping Sequence -
Dumps a
sequence
which must be a Sequence orDart
List.