JsonEditor constructor
const
JsonEditor({
- Key? key,
- required String json,
- required ValueChanged onChanged,
- Duration duration = const Duration(milliseconds: 500),
- bool enableMoreOptions = true,
- bool enableKeyEdit = true,
- bool enableValueEdit = true,
- List<
Editors> editors = const [Editors.tree, Editors.text], - Color? themeColor,
- List<
Widget> actions = const [], - bool enableHorizontalScroll = false,
- Duration searchDuration = const Duration(milliseconds: 500),
- bool hideEditorsMenuButton = false,
- List expandedObjects = const [],
JSON can be edited in two ways, Tree editor or text editor. You can disable either of them.
When UI editor is active, you can disable adding/deleting keys by using
enableMoreOptions
. Editing keys and values can also be disabled by using
enableKeyEdit
and enableValueEdit
.
When text editor is active, it will simply ignore enableMoreOptions
,
enableKeyEdit
and enableValueEdit
.
duration
is the debounce time for onChanged
function. Defaults to
500 milliseconds.
editors
is the supported list of editors. First element will be
used as default editor. Defaults to [Editors.tree, Editors.text]
.
Implementation
const JsonEditor({
super.key,
required this.json,
required this.onChanged,
this.duration = const Duration(milliseconds: 500),
this.enableMoreOptions = true,
this.enableKeyEdit = true,
this.enableValueEdit = true,
this.editors = const [Editors.tree, Editors.text],
this.themeColor,
this.actions = const [],
this.enableHorizontalScroll = false,
this.searchDuration = const Duration(milliseconds: 500),
this.hideEditorsMenuButton = false,
this.expandedObjects = const [],
}) : assert(editors.length > 0, "editors list cannot be empty");