FAQ
How does pdata know which format a file is?
From the file extension — .json, .yaml/.yml, or .toml — via pdataFormatFromExtension. Pass format: explicitly to bypass guessing entirely, which is required if the path has no recognizable extension.
Why did encodeToml throw for a null value?
TOML has no null concept at all, so there’s no way to represent one. PdataFormatException is thrown instead of silently dropping the key or writing something misleading — omit the key from the map instead.
Why does decodeToml return a Map, when decodeJson/decodeYaml can return a List?
TOML documents have no concept of a top-level scalar or list — every TOML file is a table at its root. decodeToml reflects that by always returning Map<String, dynamic>, and encodeToml requires one as input.
Does pdata preserve comments or formatting when it rewrites a file?
No. encodeYaml and encodeToml always produce a fresh, canonically-formatted document from the decoded data — comments, blank-line placement, and quoting style from the original file aren’t round-tripped. If preserving exact formatting matters, edit the file directly instead of reading, modifying, and writing it back.
Why does getInt/getBool/getString throw instead of returning null?
To surface misconfiguration immediately and clearly, with a message naming the exact key, rather than deferring a null-check crash to wherever the value is eventually used. Pass defaultValue for anything genuinely optional.
Where do I report a bug or ask a question?
GitHub Issues — see Contributing.