SchemaDocumentExt extension Extensions
SchemaDocumentExt is an extension on the SchemaDocument class which provides a useful suite of methods to manage user generated data.
Methods
-
fetch(
String cid) → Future< SchemaDocument?> -
Fetches the SchemaDocument from the current accounts application-specific data store using the provided
cid
. The account then decrypts the data and its values are returned as a SchemaDocument. A succesful transaction will return a SchemaDocument. -
get<
T> (String name) → T? -
Returns the provided
T
value from the SchemaDocument for the givenname
of the field, or null if the field does not exist. -
getList<
T> (String name) → List< T> ? -
Returns the provided
T
value from the SchemaDocument for the givenname
as a List ofT
values, or null if the field does not exist. -
set<
T> (String name, T value) → T? -
Sets the provided
T
value
to the SchemaDocument for the givenname
of the field. Returns true if the field was found and set, false otherwise. -
setList<
T> (String name, List< T> value) → List<T> ? -
Sets the provided
T
value
to the SchemaDocument for the givenname
of the field as a List. Returns true if the field was found and set, false otherwise. If the field does not exist, it will be created. -
upload(
{String? creator}) → Future< UploadDocumentResponse?> - Uploads the SchemaDocument to the current accounts application-specific data store. The account then encrypts the data and effectively becomes the only entity to be able to view the values. A succesful transaction will return a UploadDocumentResponse.