resultSuccessFail function

bool resultSuccessFail(
  1. BasicModel data, {
  2. String? text,
  3. bool nullPass = false,
})

nullPass = true data 为null 返回true

Implementation

bool resultSuccessFail(BasicModel data, {String? text, bool nullPass = false}) {
  if (BasicDio().basicDioOptions.successCode.contains(data.code) &&
      (nullPass || data.data != null)) {
    if (text != null) showToast(text);
    return true;
  } else {
    if (!BasicDio().basicDioOptions.hideMsg.contains(data.msg)) {
      showToast(data.msg);
    }
    return false;
  }
}