NetworkUtil class
网络请求工具类 - 统一处理HTTP请求、错误处理和日志
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
delete(
String url, {Map< String, String> ? headers, Duration timeout = const Duration(seconds: 30)}) → Future<Response> - DELETE 请求
-
get(
String url, {Map< String, String> ? headers, Duration timeout = const Duration(seconds: 30)}) → Future<Response> - GET 请求
-
parseJsonResponse(
Response response) → Map< String, dynamic> - 解析JSON响应,并处理常见错误
-
post(
String url, {Map< String, String> ? headers, Object? body, Duration timeout = const Duration(seconds: 30)}) → Future<Response> - POST 请求
-
put(
String url, {Map< String, String> ? headers, Object? body, Duration timeout = const Duration(seconds: 30)}) → Future<Response> - PUT 请求