getEntity method
Future
getEntity({
- required Uri uri,
- Map<
String, String> headers = const {}, - ApptiveGridLayout layout = ApptiveGridLayout.field,
Get a specific entity via a uri
headers
will be added in addition to ApptiveGridClient.defaultHeaders
This will return a Map of fieldIds and the respective values To know what DataType they are you need to Load a Grid via loadGrid and compare Grid.fields with the ids
The entity will be layed out according to layout
The id of the entity can be accessed via ['_id']
Implementation
Future<dynamic> getEntity({
required Uri uri,
Map<String, String> headers = const {},
ApptiveGridLayout layout = ApptiveGridLayout.field,
}) async {
await authenticator.checkAuthentication();
final url = _generateApptiveGridUri(uri);
final response = await _client.get(
url.replace(
queryParameters: {
'layout': layout.queryParameter,
},
),
headers: _createHeadersWithDefaults(headers),
);
if (response.statusCode >= 400) {
throw response;
}
return jsonDecode(response.body);
}