DataExplorerStore class

Handles the data and manages the state of a data explorer.

The data must be initialized by calling the buildNodes method. This method takes a raw JSON object Map<String, dynamic> or List<dynamic> and builds a flat node list of NodeViewModelState.

The property displayNodes contains a flat list of all nodes that can be displayed. This means that each node property is an element in this list, even inner class properties.

Example

{@tool snippet}

Considering the following JSON file with inner classes and properties:

{
  "someClass": {
    "classField": "value",
    "innerClass": {
        "innerClassField": "value"
        }
    }
    "arrayField": [0, 1]
}

The [displayNodes] representation is going to look like this:
[
  node {"someClass": ...},
  node {"classField": ...},
  node {"innerClass": ...},
  node {"innerClassField": ...},
  node {"arrayField": ...},
  node {"0": ...},
  node {"1": ...},
]

{@end-tool}

This data structure allows us to render the nodes easily using a ListView.builder for example, or any other kind of list rendering widget.

Inheritance

Constructors

DataExplorerStore()

Properties

displayNodes → UnmodifiableListView<NodeViewModelState>
Gets the list of nodes to be displayed.
no setter
focusedSearchResult → SearchResult
Gets the current focused search result.
no setter
focusedSearchResultIndex → int
Gets the current focused search node index. If there are search results, this is going to be an index of searchResults list. It always going to be 0 by default.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
searchResults → UnmodifiableListView<SearchResult>
Gets a list containing the nodes found by the current search term.
no setter
searchTerm → String
Gets the current search term.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
areAllCollapsed() → bool
Returns true if all nodes are collapsed, otherwise returns false.
areAllExpanded() → bool
Returns true if all nodes are expanded, otherwise returns false.
buildNodes(dynamic jsonObject, {bool areAllCollapsed = false}) → Future
Uses the given jsonObject to build the displayNodes list.
collapseAll() → void
Collapses all nodes.
collapseNode(NodeViewModelState node) → void
Collapses the given node so its children won't be visible.
dispose() → void
Discards any resources used by the object.
inherited
expandAll() → void
Expands all nodes.
expandNode(NodeViewModelState node) → void
Expands the given node so its children become visible.
expandSearchResults() → void
Expands all the parent nodes of each SearchResult.node in searchResults.
focusNextSearchResult({bool loop = false}) → void
Sets the focus on the next search result.
focusPreviousSearchResult({bool loop = false}) → void
Sets the focus on the previous search result.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
Executes a search in the current data structure looking for the given search term.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited