https://github.com/shyndman/yaml_fluency
Write YAML using a fluent syntax
https://github.com/shyndman/yaml_fluency
dart flutter serialization yaml
Last synced: about 2 months ago
JSON representation
Write YAML using a fluent syntax
- Host: GitHub
- URL: https://github.com/shyndman/yaml_fluency
- Owner: shyndman
- License: mit
- Created: 2021-03-13T09:29:50.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-13T11:09:17.000Z (over 5 years ago)
- Last Synced: 2025-04-02T01:35:52.363Z (about 1 year ago)
- Topics: dart, flutter, serialization, yaml
- Language: Dart
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# YAML Fluency
[](https://pub.dev/packages/yaml_fluency)
[](https://github.com/madewithfelt/yaml_fluency/actions?query=test)
Writes YAML strings fluently
Write this:
```dart
final userWriter = YamlMapWriter()
..writeMap(
'man',
(man) => man
..writeString('email', 'scott@madewithfelt.com')
..writeString('displayName', 'shyndman', quoted: false)
..writeBool('activated', true)
..writeString('bio', stripLeadingSpace('''
Ontario native, and dog whisperer.
Programming Dart/Flutter these days.
'''), multiline: true)
..writeMap(
'account',
(account) => account
..writeNumber('loginCount', 5)
..writeString(
'ticket',
Uuid().v4(),
),
),
)
..writeMap(
'dog',
(dog) => dog
..writeString('name', 'Henry')
..writeNumber('weight (lbs)', 24.5)
..writeBool('awesome', true)
..writeString('bio', stripLeadingSpace('''
California dog, coming to terms
with the Canadian winter.
'''), multiline: true),
);
```
To get this:
```yaml
man:
email: "scott@madewithfelt.com"
displayName: shyndman
activated: true
bio: |-
Ontario native, and dog whisperer.
Programming Dart/Flutter these days.
account:
loginCount: 5
ticket: "d17933a8-4e24-4e66-9522-d59124f84503"
dog:
name: "Henry"
weight (lbs): 24.5
awesome: true
bio: |-
California dog, coming to terms
with the Canadian winter.
```