1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- class HttpResult<T> {
- HttpResult(
- {required this.isSuccess,
- dynamic dataJson,
- List<dynamic>? listJson,
- this.code = -1,
- this.msg,
- this.errorMsg}) {
- this._dataJson = dataJson;
- this._listJson = listJson;
- }
-
- bool isSuccess = false;
-
- dynamic _dataJson;
- List<dynamic>? _listJson;
-
- T? data;
- List<T>? list;
-
- int code = -1;
-
- String? msg;
-
- String? errorMsg;
-
- Map<String, dynamic>? getDataJson() {
- if (_dataJson is Map<String, dynamic>) {
- return _dataJson as Map<String, dynamic>;
- }
- return null;
- }
-
- dynamic getDataDynamic() {
- return _dataJson;
- }
-
- List<dynamic>? getListJson() {
- return _listJson;
- }
-
- void setData(T data) {
- this.data = data;
- }
- void setList(List<T> list) {
- this.list = list;
- }
-
-
- HttpResult<T> convert<T>({T? data, List<T>? list}) {
- var result = HttpResult<T>(
- isSuccess: this.isSuccess,
- dataJson: this._dataJson,
- listJson: this._listJson,
- code: this.code,
- msg: this.msg,
- errorMsg: this.errorMsg);
- result.data = data;
- result.list = list;
- return result;
- }
- }
|