toml_viewer 2.0.0 copy "toml_viewer: ^2.0.0" to clipboard
toml_viewer: ^2.0.0 copied to clipboard

A Flutter widget for displaying TOML files as interactive, searchable, lazily-rendered tree views with partial-parse error reporting, a raw source view, light/dark theming, custom styling, and extensi [...]

Changelog #

2.0.0 #

A correctness and performance release. The rendering pipeline was rebuilt around a typed node model, three long-standing bugs were fixed, and the configuration API was reorganised.

Fixed #

  • collapseAll() did nothing to untouched nodes. It called Map.updateAll, which only affects paths already toggled; every node that had merely been rendered kept the default-expanded fallback and stayed open. expandAll() had the mirror-image bug with defaultExpanded: false. Both now flip the fallback itself.
  • Arrays were labelled Array of Table[n]. The element type was read from the list rather than its elements, so [1, 2, 3] reported Table. Arrays now report Array of int[3], Array of mixed[2], or Array[0].
  • The declared Flutter minimum was unbuildable. Color.withValues and Color.r/g/b require Flutter 3.27 / Dart 3.6, but the package advertised Flutter 3.10. The constraint now matches reality.
  • The partial-parse section splitter mangled valid TOML. Any line starting with [ was treated as a table header, so multi-line arrays ( [1, 2],) and bracketed lines inside """ blocks were split apart and reported as phantom errors. The splitter is now header-shaped and string-aware.
  • Duplicate keys were silently resolved. Sections were deep-merged with "later wins" and no report. Collisions now produce a TomlParseError.
  • Monospaced text fell back to the system default on iOS, macOS, and web, where 'monospace' is not a real family. Use TomlViewerStyle.monospaceFallback for a stack that resolves everywhere.
  • Row semantics were not reachable. Each row is now a single accessible node with a label, a tap action, and an expanded state.
  • TomlView asserted without a Material ancestor. Rows use InkWell, so dropping the viewer into a plain Container or a custom shell threw. It now supplies its own transparent Material.

Added #

  • Lazy rendering. The tree is flattened into the list of currently visible rows and rendered with a SliverList.builder, so cost scales with the viewport rather than the document. A 5,000-key file now builds a few dozen rows instead of all 5,000.
  • Search. TomlView(searchQuery: ...) filters to matching keys and values, keeps and force-expands the ancestors of each hit, and highlights the match. caseSensitiveSearch opts into exact matching.
  • Raw source view. TomlView(mode: TomlViewMode.source) shows the original text with line numbers and error lines highlighted. Also available directly as TomlSourceView.
  • Clipboard support. Long-press copies the value, the path, or both, per TomlViewerConfig.copyMode; onValueCopied reports what was written. The tree is wrapped in a SelectionArea unless enableTextSelection is false.
  • New sources. TomlView.loader(() async => ...) covers files, HTTP, and anything else without this package taking an I/O dependency; TomlView.stream(...) re-parses on every emission.
  • A public node model. TomlNode, TomlTableNode, TomlArrayNode, and TomlLeafNode expose the parsed tree with stable paths and lazy children; flattenVisible turns it into rows. TomlFormat exposes the value formatting helpers, and TomlParser is now exported so TomlParseResult can actually be obtained without the widget.
  • Expansion-state persistence. TomlExpandController.overrides and restore save and reload what the user opened; expandToPath reveals a node by opening every ancestor; setExpanded sets an explicit state.
  • Value truncation. TomlViewerStyle.maxValueLines (default 1) and maxValueLength (default 512) keep one enormous string from dominating the view.
  • maxRenderedErrors (default 100) caps the rendered error list.
  • emptyBuilder, padding, shrinkWrap, physics, and scrollController on TomlView.
  • clear() on TomlViewerConfig and TomlViewerStyle, which can reset a field to null — something copyWith cannot express.
  • Value equality on TomlViewerConfig, TomlViewerStyle, and TomlViewerColors.
  • CI running format, analyze, tests, goldens, the example, and a publish dry-run; golden tests covering seven rendered states.

Changed — breaking #

  • TomlViewerTheme now works. It was exported and documented but never read by any widget. TomlView.config is nullable and resolves as: the widget's own config, then the nearest TomlViewerTheme, then a palette matching the ambient Theme. The theme's separate style property is gone — styling lives in config.style, so there is one place to set it.

    // Before
    TomlViewerTheme(config: ..., style: TomlViewerStyle(indentation: 20), child: ...)
    // After
    TomlViewerTheme(config: TomlViewerConfig(style: TomlViewerStyle(indentation: 20)), child: ...)
    
  • Colours moved into TomlViewerColors. The ten colour parameters on TomlViewerConfig are now one colors field, which is what let .light(), .dark(), and .of() stop repeating an identical parameter list. Read-only getters (valueColor, keyColor, …) remain, deprecated, until 3.0.0.

    // Before
    TomlViewerConfig(valueColor: Colors.red, keyColor: Colors.teal)
    // After
    TomlViewerConfig(colors: TomlViewerColors(value: Colors.red, tableKey: Colors.teal))
    
  • TomlViewerConfig.of(context) takes only a context. Chain copyWith for anything else: TomlViewerConfig.of(context).copyWith(expandMode: false).

  • createConfusedCopy() is gone. It randomised every colour and had no place in a viewer's public API.

  • maxValueLines defaults to 1. Values ellipsise instead of wrapping; pass style.clear(maxValueLines: true) for the old behaviour.

  • Empty tables and arrays are no longer expandable, since there is nothing to reveal.

  • Builder and callback signatures take Object? instead of dynamic, as a consequence of enabling strict-raw-types.

  • TomlObjectViewer and TomlArrayViewer are replaced by the single internal TomlRow. TomlUtils is replaced by TomlFormat.

Documentation #

  • A README rebuilt for both newcomers and integrators: a demo GIF rendered from the real widget, three theme-aware SVG diagrams (what it does, the rendering pipeline, the anatomy of a row), a troubleshooting FAQ, and a migration section. Both are generated — tool/make_gif.sh and tool/make_diagrams.py.

Packaging #

  • .pubignore drops the example's platform scaffolding, the test suite, and the documentation assets from the published archive, taking it from 960 KB to 715 KB — almost all of which is now the pub.dev screenshots themselves.
  • Stricter analysis: strict-casts, strict-inference, strict-raw-types, and public_member_api_docs among others.

1.0.0 #

  • Initial stable release: tree view, partial-parse error reporting, light/dark themes, custom styling, interaction callbacks, and builder support.
5
likes
150
points
93
downloads
screenshot

Documentation

API reference

Publisher

verified publishersudhi.in

Weekly Downloads

A Flutter widget for displaying TOML files as interactive, searchable, lazily-rendered tree views with partial-parse error reporting, a raw source view, light/dark theming, custom styling, and extensible builders.

Repository (GitHub)
View/report issues
Contributing

Topics

#toml #viewer #config #tree-view #json-viewer

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

flutter, toml

More

Packages that depend on toml_viewer