dataFromHttpResponse method

void dataFromHttpResponse(
  1. NUIHttpResponse resp
)

Implementation

void dataFromHttpResponse(NUIHttpResponse resp) {
  if (!resp.success) {
    error = DfError(code: resp.code, message: resp.message);
  }
  else if (resp.response != null) {
    result = [];
    String tStr = resp.response.trim();
    if (tStr.startsWith("[")) {
      List data = jsonDecode(tStr);
      for (Map<String,dynamic> item in data) {
        result.add(item);
      }
    }
    else if (tStr.length > 0) {
      singleResult = jsonDecode(tStr);
    }
  }
  return;
}