AssertableJsonBase class abstract

An abstract base class for assertable JSON data.

This class provides a set of utility methods for working with JSON data, including type-safe access to values, lists, and maps. It also includes a mixin for handling interactions, which can be used for testing or other purposes.

Implementers

Constructors

AssertableJsonBase()

Properties

hashCode int
The hash code for this object.
no setterinherited
json → dynamic
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

assertEmpty([String? path]) → void
Asserts that the value at the specified path is empty.
each(dynamic callback(AssertableJson)) AssertableJson
Iterates over the JSON data, either an array or an object, and calls the provided callback function for each element.
etc() AssertableJson
Marks all properties in the JSON object as accessed.
inherited
exists(String path) bool
Checks if the specified path exists within the JSON data.
first(dynamic callback(AssertableJson)) AssertableJson
Scopes the current AssertableJson instance to the first element of the JSON data.
get<T>(String path) → T?
Gets the value at the specified path and casts it to the specified type T.
getList<T>(String path) List<T>
Gets a list of items at the specified path and casts them to the specified type T.
getMap<T>(String path) Map<String, T>
getRequired<T>(String path) → T
Gets the value at the specified path and casts it to the specified type T.
interactsWith(String key) → void
Records an interaction with the specified JSON property key.
inherited
keys([String? path]) List<String>
Gets a list of all keys at the specified path in the JSON data.
length([String? path]) int
Gets the length of the JSON data at the specified path.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scope(String key, dynamic callback(AssertableJson)) AssertableJson
Scopes the current AssertableJson instance to the specified key and calls the provided callback function with the scoped instance.
toString() String
A string representation of this object.
inherited
values<T>([String? path]) List<T>
Gets a list of all the values at the specified path within the JSON data.
verifyInteracted() → void
Verifies that all properties in the JSON object have been accessed.
inherited

Operators

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