CObjectExtension extension

Provides helper methods for the CObject for set / get data, implementing a ChangeNotifier, and being able to serialize / deserialize between JSON and string data.

on

Methods

addListener(void listener()) → void
Adds an event listener so when changes are made via the CObjectExtension.set method.
get<T>(String key) → T
Provides the ability to extract a data element from the represented CObject.
parse(String data) bool
Attempts to parse the serialized string data and turn it into a CObject. Any data previously held by this object is cleared. False is returned if it could not parse the data.
removeListener(void listener()) → void
Removes an event listener from the CObject.
set<T>(String key, T value, {bool notify = false}) → void
Provides a method to set data elements on the CObject.
stringify() String?
Converts the JSON object to a string returning null if it cannot.