Dumping Sequence topic

Dumps any object in Dart that implements Iterable. The default scalar style is ScalarStyle.plain (you can override this).

Flow Sequences

Flow sequences start with [ and terminate with ]. All entries are always dumped on a new line.

dumpObject(
  ['hello', 24, true, 24.0],
  dumper: ObjectDumper.of(iterableStyle: NodeStyle.flow),
);
# Output in yaml
[
 hello,
 24,
 true,
 24.0
]

Tip

You can inline a flow sequence by passing in forceIterablesInline as true.

Block Sequences

Block sequences have no explicit starting or terminating indicators. However, entries always have a leading - .

dumpObject(
  ['hello', 24, true, 24.0],
  dumper: ObjectDumper.of(
    iterableStyle: NodeStyle.block,
    scalarStyle: ScalarStyle.literal,
  ),
);
# Output in yaml
- |-
  hello
- |-
  24
- |-
  true
- |-
  24.0

Functions

dumpObject(Object? object, {required YamlDumper dumper, int indent = 0, bool includeYamlDirective = false, Iterable<Directive>? directives, OnProperties? objectProperties, bool includeGlobalTags = true, bool includeDocumendEnd = false}) String Dumping Scalars Dumping Sequence Dumping Mapping Dumping Types Dumping YAML Documents
Dumps an object with the specified indent. Uses the dumper provided.