Trace: • Data API
(flutterui)
Data API
For managing the data of a screen, the CustomScreen provides a simple API which can be accessed via getDataApi('DATA_PROVIDER_NAME')
from anywhere in it's extended classes.
This API provides following functions:
dynamic getValue(String columnName)
Provides the value of a specific columnList getValues(List columnNames)
Provides a list of values for the specified columns
setValue(String columnName, dynamic value)
Sets the value for a specific columnsetValues(List columnNames, List values)
Sets the values for a list of specified columnsinsertRecord()
Inserts a new recorddeleteRecord(int index)
Deletes the record at the specified indexselectRecord(int index)
Selects the record at the specified index
The client persists those changes by itself.
Examples
Reading a value
DataApi dataApi = getDataApi('JVxMobileDemo/Con-CG/contacts#4'); FlatButton( child: Text("Call"), onPressed: () { phone = dataApi.getValue("PHONE"); launch("tel://$phone"); })
Setting a value
DataApi dataApi = getDataApi('JVxMobileDemo/Con-CG/contacts#4'); FlatButton( child: Text("Set phone number"), onPressed: () { phone = dataApi.setValue("PHONE", '+43660123456'); } )