buildResult method
Encapsulate build result objects creation to avoid inconsistencies
Implementation
ModResourceResult<Out> buildResult({Out? data = null, int code = -1}) {
ModResourceResult<Out> res = ModResourceResult();
res.data = data;
res.state = res.hasData()? ResourceState.SUCCESS : ResourceState.ERROR;
res.error = res.isError()? ThirdPartyErrorModel(code: code) : null;
return res;
}