get method

Future<Map<String, dynamic>?> get(
  1. String id, {
  2. bool force = false,
  3. List<JsendStatusHandler>? statusHandlers,
})

Implementation

Future<Map<String, dynamic>?> get(String id,
    {bool force = false, List<JsendStatusHandler>? statusHandlers}) async {
  var hasLoadedCopy = _hasLoadedID(id);
  if (force) hasLoadedCopy = false;
  if (!hasLoadedCopy) {
    (await jsendResponse.fromAPIRequest(
      APIRequest(path: endpoint + '/' + id),
      onSuccess: (jsendResponse res) {
        _setItem(_getSingluarDataFromJsendResponse(res));
      },
      statusHandlers: statusHandlers,
    ));
  }
  return _getLoadedItemByID(id);
}