TomlView class
A widget that parses and displays TOML content as an interactive tree view.
From a TOML string:
TomlView(content: 'title = "My App"')
From a Flutter asset file:
TomlView.asset('assets/config.toml')
From an already-parsed map:
TomlView.fromMap({'title': 'My App', 'debug': true})
From anywhere else — a file, an HTTP response, a database — with TomlView.loader, which keeps this package free of an I/O dependency and works on every platform including web:
TomlView.loader(() => File('config.toml').readAsString())
TomlView.loader(() async => (await http.get(uri)).body)
From a stream that re-renders on every emission:
TomlView.stream(configChanges)
Rows are rendered lazily from a flattened list, so only what is on screen is built — a large configuration file costs the same as a small one.
Customize appearance with config, filter with searchQuery, and switch to the raw source with mode.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TomlView
Constructors
- TomlView({Key? key, required String content, TomlViewerConfig? config, TomlExpandController? expandController, TomlViewMode mode = TomlViewMode.tree, String? searchQuery, bool caseSensitiveSearch = false, EdgeInsetsGeometry padding = EdgeInsets.zero, bool shrinkWrap = false, ScrollPhysics? physics, ScrollController? scrollController, WidgetBuilder? loadingBuilder, Widget errorBuilder(BuildContext context, Object error)?, WidgetBuilder? emptyBuilder})
-
Creates a TomlView from a TOML string.
const
- TomlView.asset(String assetFilePath, {Key? key, TomlViewerConfig? config, TomlExpandController? expandController, TomlViewMode mode = TomlViewMode.tree, String? searchQuery, bool caseSensitiveSearch = false, EdgeInsetsGeometry padding = EdgeInsets.zero, bool shrinkWrap = false, ScrollPhysics? physics, ScrollController? scrollController, WidgetBuilder? loadingBuilder, Widget errorBuilder(BuildContext context, Object error)?, WidgetBuilder? emptyBuilder})
-
Creates a TomlView from a Flutter asset file path.
const
-
TomlView.fromMap(Map<
String, dynamic> map, {Key? key, TomlViewerConfig? config, TomlExpandController? expandController, TomlViewMode mode = TomlViewMode.tree, String? searchQuery, bool caseSensitiveSearch = false, EdgeInsetsGeometry padding = EdgeInsets.zero, bool shrinkWrap = false, ScrollPhysics? physics, ScrollController? scrollController, WidgetBuilder? loadingBuilder, Widget errorBuilder(BuildContext context, Object error)?, WidgetBuilder? emptyBuilder}) -
Creates a TomlView from a pre-parsed Map.
const
-
TomlView.loader(Future<
String> load(), {Key? key, TomlViewerConfig? config, TomlExpandController? expandController, TomlViewMode mode = TomlViewMode.tree, String? searchQuery, bool caseSensitiveSearch = false, EdgeInsetsGeometry padding = EdgeInsets.zero, bool shrinkWrap = false, ScrollPhysics? physics, ScrollController? scrollController, WidgetBuilder? loadingBuilder, Widget errorBuilder(BuildContext context, Object error)?, WidgetBuilder? emptyBuilder}) -
Creates a TomlView that obtains its TOML from an async
loadcallback.const -
TomlView.stream(Stream<
String> source, {Key? key, TomlViewerConfig? config, TomlExpandController? expandController, TomlViewMode mode = TomlViewMode.tree, String? searchQuery, bool caseSensitiveSearch = false, EdgeInsetsGeometry padding = EdgeInsets.zero, bool shrinkWrap = false, ScrollPhysics? physics, ScrollController? scrollController, WidgetBuilder? loadingBuilder, Widget errorBuilder(BuildContext context, Object error)?, WidgetBuilder? emptyBuilder}) -
Creates a TomlView that re-parses on every emission of
source.const
Properties
- caseSensitiveSearch → bool
-
Whether searchQuery matching is case-sensitive.
final
- config → TomlViewerConfig?
-
Configuration for colours, styling, error display, and behaviour.
final
- emptyBuilder → WidgetBuilder?
-
Builder used when there is nothing to show — an empty document, or a
searchQuery with no matches.
final
- errorBuilder → Widget Function(BuildContext context, Object error)?
-
Builder for the fatal error state.
final
- expandController → TomlExpandController?
-
Optional external controller for expand/collapse state.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → WidgetBuilder?
-
Builder for the loading state (asset loading / large-file parsing).
final
- mode → TomlViewMode
-
Whether to show the tree or the raw source.
final
- padding → EdgeInsetsGeometry
-
Padding around the scrollable content.
final
- physics → ScrollPhysics?
-
Scroll physics for the list.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
Scroll controller for the list.
final
- searchQuery → String?
-
Filters the tree to nodes whose key or value contains this text.
final
- shrinkWrap → bool
-
Whether the list should size itself to its contents.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< TomlView> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited