toml
0.18.0, released 11 months ago by an unverified publisher
Parse and encode TOML configuration files in Dart.
WASM-ready
What it does
Provides a TOML v1.1.0 parser that converts TOML documents to Dart maps and an encoder that converts maps back to TOML strings. Supports loading files from assets, HTTP, or local file system.
AI-written summary of version 0.18.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read or write TOML configuration files in a Dart or Flutter app.
- You require a pure‑Dart solution without native dependencies.
Skip it when
- You need a JSON‑or‑YAML‑only format or require schema validation.
- Performance‑critical parsing of extremely large files is needed.
Strengths
- Full TOML 1.1 support including inline tables and new escape sequences
- Works on all Dart platforms (mobile, web, desktop)
- No native code, easy to add as a dependency
Weaknesses
- Only supports TOML; no other config formats
- Encoder does not produce inline tables or dotted keys
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
import 'package:toml/toml.dart';
void main() async {
var doc = await TomlDocument.load('config.toml');
var map = doc.toMap();
print(map);
var encoded = TomlDocument.fromMap(map).toString();
print(encoded);
}Alternatives
Packages that do the same job and could replace toml.
Works with
Packages commonly used together with toml: ones it builds on, ones built on it, and its own family.
- petitparsertoml depends on itBuild fast, composable, and type-safe grammars and parsers in plain Dart code.
- webtoml depends on itLightweight bindings for browser APIs via JS interop
- native_toolchain_rustBuilt on tomlBuild and bundle Rust code into a Dart/Flutter project via build hooks.
- flutter_i18nBuilt on tomlI18n made easy for Flutter using JSON, XML, YAML or TOML files.
- embedBuilt on tomlGenerates Dart code that embeds arbitrary file contents as literals.
- stellar_flutter_sdkBuilt on tomlStellar SDK for Flutter to query Horizon and Soroban RPC, and manage transactions.
- flutter_omarchyBuilt on tomlUI toolkit and theming system designed for the Omarchy Arch Linux desktop environment.