VooJsonTree class
A feature-rich JSON tree viewer/editor widget.
Displays JSON data in an interactive tree structure with support for:
- Collapsible/expandable nodes
- Syntax highlighting by value type
- Search functionality
- Copy path/value to clipboard
- Keyboard navigation
Basic Usage
VooJsonTree(
data: {'name': 'John', 'age': 30},
)
With Controller
final controller = JsonTreeController();
controller.setData(jsonData);
VooJsonTree(
controller: controller,
theme: VooJsonTreeTheme.dark(),
config: JsonTreeConfig(
expandDepth: 2,
enableSearch: true,
),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- VooJsonTree
Constructors
- VooJsonTree({Key? key, dynamic data, JsonTreeController? controller, VooJsonTreeTheme? theme, JsonTreeConfig? config, JsonTreeBuilders? builders, bool showToolbar = true, bool showPathBreadcrumb = false, String rootName = 'root', void onNodeTap(JsonNode node)?, void onNodeDoubleTap(JsonNode node)?, void onValueChanged(String path, dynamic newValue)?})
-
Creates a new VooJsonTree.
const
- VooJsonTree.compact({Key? key, required dynamic data, VooJsonTreeTheme? theme, String rootName = 'root'})
-
Creates a compact VooJsonTree with minimal UI.
factory
- VooJsonTree.developer({Key? key, required dynamic data, VooJsonTreeTheme? theme, String rootName = 'root', void onNodeTap(JsonNode node)?})
-
Creates a developer-friendly VooJsonTree for debugging.
factory
- VooJsonTree.editable({Key? key, required dynamic data, VooJsonTreeTheme? theme, String rootName = 'root', void onValueChanged(String path, dynamic newValue)?, void onNodeTap(JsonNode node)?})
-
Creates an editable VooJsonTree.
factory
- VooJsonTree.fromString(String jsonString, {Key? key, VooJsonTreeTheme? theme, JsonTreeConfig? config, bool showToolbar = true, String rootName = 'root'})
-
Creates a VooJsonTree from a JSON string.
factory
- VooJsonTree.minimal({Key? key, required dynamic data, VooJsonTreeTheme? theme, String rootName = 'root', void onNodeTap(JsonNode node)?})
-
Creates a minimal VooJsonTree with only essential features.
factory
- VooJsonTree.raw({Key? key, required dynamic data, JsonTreeConfig? config, String rootName = 'root', void onNodeTap(JsonNode node)?, void onNodeDoubleTap(JsonNode node)?})
-
Creates a VooJsonTree with transparent background and no container styling.
factory
- VooJsonTree.readOnly({Key? key, required dynamic data, VooJsonTreeTheme? theme, bool showToolbar = false, String rootName = 'root'})
-
Creates a read-only VooJsonTree.
factory
- VooJsonTree.searchable({Key? key, required dynamic data, VooJsonTreeTheme? theme, JsonTreeConfig? config, String rootName = 'root'})
-
Creates a VooJsonTree with search enabled.
factory
Properties
- builders → JsonTreeBuilders?
-
Custom builders for node rendering.
final
- config → JsonTreeConfig?
-
Configuration options.
final
- controller → JsonTreeController?
-
External controller for managing tree state.
final
- data → dynamic
-
The JSON data to display.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onNodeDoubleTap → void Function(JsonNode node)?
-
Callback when a node is double-tapped.
final
- onNodeTap → void Function(JsonNode node)?
-
Callback when a node is tapped.
final
- onValueChanged → void Function(String path, dynamic newValue)?
-
Callback when a value is changed (editing mode).
final
- rootName → String
-
Name for the root node.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showPathBreadcrumb → bool
-
Whether to show the path breadcrumb for selected node.
final
- showToolbar → bool
-
Whether to show the toolbar with search.
final
- theme → VooJsonTreeTheme?
-
Theme configuration for styling.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< VooJsonTree> -
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