getObject method
Get the object referred to by this AlgoliaObjectReference.
If the object does not yet exist, it will be created.
Implementation
Future<AlgoliaObjectSnapshot> getObject() async {
assert(_index != null, 'You can\'t get an object without an index.');
assert(_objectId != null, 'You can\'t get an object without an objectID.');
var response = await algolia._apiCall(
ApiRequestType.get,
'indexes/$encodedIndex/$encodedObjectID',
);
Map<String, dynamic> body = json.decode(response.body);
if (!(response.statusCode >= 200 && response.statusCode < 300)) {
throw AlgoliaError._(body, response.statusCode);
}
return AlgoliaObjectSnapshot._(algolia, _index!, body);
}