feat: support max running tasks config (#112)

This commit is contained in:
Li Wei authored and GitHub committed 2023-05-10 18:00:58 +08:00
1 parent 1e08ecd8db
commit d9c5ca339f
22 files changed
+269 -129

No files matched your search

+5 -8
View File
@@ -73,15 +73,12 @@ Future<T> _parse<T>(
) async {
try {
var resp = await fetch();
if (fromJsonT != null) {
final result = Result<T>.fromJson(resp.data, fromJsonT);
if (result.code == 0) {
return result.data as T;
} else {
throw Exception(result);
}
fromJsonT ??= (json) => null as T;
final result = Result<T>.fromJson(resp.data, fromJsonT);
if (result.code == 0) {
return result.data as T;
} else {
return null as T;
throw Exception(result);
}
} on DioError catch (e) {
throw Exception(Result(code: 1000, msg: e.message));