parsing/ini_parser_utils library

INI / .env configuration parser — roadmap #626.

Reads the two near-universal flat-config formats without a dependency: [section] headers with key=value lines (INI), and the section-less KEY=value files dotenv tools load. One core line walker backs both public entry points. Comments (# / ; full-line), surrounding quotes, and the export prefix are handled; values keep # literally (no inline-comment stripping) so passwords, URLs, and color hexes survive unquoted.

Constants

iniGlobalSection → const String
Section key under which entries appearing before any [section] header are collected. Empty string can't collide with a real [name] (a header always yields at least the bracket-trimmed text, and [] trims to empty only via an explicit empty header, which is degenerate config the caller controls).

Functions

parseEnv(String input) Map<String, String>
Parses input as a .env file into a flat key → value map. export prefixes are stripped. .env files have no sections, but if [section] headers do appear, every section's entries are flattened into one map (later keys win) rather than discarded — so the result is never lossy.
parseIni(String input, {bool allowExport = false}) Map<String, Map<String, String>>
Parses input as INI text into section → key → value. Entries before the first [section] land under iniGlobalSection (''). A declared but empty [section] still appears as an empty map. The separator is the first = on the line (so url=http://x keeps the colon in the value). Blank lines and full-line # / ; comments are skipped; any other line lacking = throws a FormatException naming the offending line — strict by design so a typo in config surfaces instead of being silently dropped.