1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import 'package:ftrecruiter/comm/utils/log_utils.dart';
- class HttpResult<T> {
- HttpResult({required this.isSuccess, dynamic dataJson, List<dynamic>? listJson, this.errorCode, this.errorMsg}) {
- this._dataJson = dataJson;
- this._listJson = listJson;
- }
-
- bool isSuccess = false;
-
- dynamic _dataJson;
- List<dynamic>? _listJson;
-
- T? data;
- List<T>? list;
-
- int? errorCode;
- String? errorMsg;
- Map<String, dynamic>? getDataJson() {
- if (_dataJson is Map<String, dynamic>) {
- return _dataJson as Map<String, dynamic>;
- }
- return null;
- }
- 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,
- errorCode: this.errorCode,
- errorMsg: this.errorMsg);
- result.data = data;
- result.list = list;
- return result;
- }
- }
|