JsonObjectLite<E> class
JsonObjectLite allows .property name access to JSON by using noSuchMethod. The object is set to not immutable so properties can be added.
- Implemented types
Constructors
- JsonObjectLite()
- Default constructor. Creates a new empty map.
- JsonObjectLite.fromJsonString(String jsonString, [JsonObjectLite? t, bool recursive = true])
-
Eager constructor parses
jsonString
using JsonDecoder.factory
Properties
-
entries
→ Iterable<
MapEntry> -
The map entries of this.
no setterinherited
- first → E
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether there is no key/value pair in the map.
no setteroverride
- isImmutable ↔ bool?
-
isImmutable indicates if a new item can be added to the internal
map via the noSuchMethod property, or the functions inherited from the
map interface.
getter/setter pair
- isNotEmpty → bool
-
Whether there is at least one key/value pair in the map.
no setteroverride
-
iterator
→ Iterator<
E> -
no setter
- keys → Iterable
-
The keys of this.
no setteroverride
- last → E
-
no setter
- length → int
-
The number of key/value pairs in the map.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → E
-
no setter
- values → Iterable
-
The values of this.
no setteroverride
Methods
-
addAll(
dynamic items) → void -
Adds all key/value pairs of
other
to this map.override -
addEntries(
Iterable< MapEntry> newEntries) → void -
Adds all key/value pairs of
newEntries
to this map.inherited -
any(
bool f(dynamic element)) → bool - Iterable implementation methods and properties
-
cast<
RK, RV> () → Map< RK, RV> -
Provides a view of this map as having
RK
keys andRV
instances, if necessary.inherited -
clear(
) → void -
If isImmutable is false, then allow the map to be cleared
Throw JsonObjectLiteException if we're not allowed to clear.
override
-
contains(
dynamic element) → bool -
containsKey(
dynamic value) → bool -
Whether this map contains the given
key
.override -
containsValue(
dynamic value) → bool -
Map implementation methods and properties *
override
-
elementAt(
int index) → E -
every(
bool f(dynamic element)) → bool -
expand<
T> (dynamic f(dynamic element)) → Iterable< T> -
firstWhere(
bool test(dynamic value), {dynamic orElse}) → dynamic -
fold<
T> (T initialValue, T combine(T a, dynamic b)) → T -
forEach(
void func(dynamic key, dynamic value)) → void -
Applies
action
to each key/value pair of the map.override -
join(
[String separator = '']) → String -
lastWhere(
bool test(dynamic value), {dynamic orElse}) → dynamic -
map<
K2, V2> (MapEntry< K2, V2> convert(dynamic key, dynamic value)) → Map<K2, V2> -
Returns a new map where all entries of this map are transformed by
the given
convert
function.inherited -
noSuchMethod(
Invocation mirror) → dynamic -
noSuchMethod()
If we try to access a property using dot notation (eg: o.wibble ), then
noSuchMethod will be invoked, and identify the getter or setter name.
It then looks up in the map contained in _objectData (represented using
this (as this class implements Map, and forwards it's calls to that
class.
If it finds the getter or setter then it either updates the value, or
replaces the value.
override
-
putIfAbsent(
dynamic key, dynamic ifAbsent()) → void -
If isImmutable is false, or the key already exists,
then allow the edit.
Throw JsonObjectLiteException if we're not allowed to add a new
key
override
-
reduce(
dynamic combine(dynamic value, dynamic element)) → dynamic -
remove(
dynamic key) → dynamic -
If isImmutable is false, or the key already exists,
then allow the removal.
Throw JsonObjectLiteException if we're not allowed to remove a
key
override
-
removeWhere(
bool test(dynamic key, dynamic value)) → void -
Removes all entries of this map that satisfy the given
test
.inherited -
singleWhere(
bool test(dynamic value), {dynamic orElse}) → dynamic -
skip(
int n) → Iterable< E> -
take(
int n) → Iterable< E> -
toIterable(
) → Iterable? - Returns either the underlying parsed data as an iterable list (if the underlying data contains a list), or returns the map.values (if the underlying data contains a map).
-
toList(
{bool growable = true}) → List -
toSet(
) → Set -
toString(
) → String -
Returns a string representation of the underlying object data
override
-
update(
dynamic key, dynamic update(dynamic value), {dynamic ifAbsent()?}) → dynamic -
Updates the value for the provided
key
.inherited -
updateAll(
dynamic update(dynamic key, dynamic value)) → void -
Updates all values.
inherited
-
where(
bool f(dynamic element)) → Iterable< E>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
dynamic key) → dynamic -
The value for the given
key
, ornull
ifkey
is not in the map.override -
operator []=(
dynamic key, dynamic value) → void -
Specific implementations which check isImmtable to determine if an
unknown key should be allowed.
override
Static Methods
-
toTypedJsonObjectLite(
JsonObjectLite src, JsonObjectLite dest) → JsonObjectLite - Typed JsonObjectLite
Constants
- decoder → const JsonDecoder
- JSON decoder
- encoder → const JsonEncoderLite
- JSON encoder, use our encoder not the one from convert