/// 服务端统一响应信封 `{code, message, data}` 的解析结果。 class ApiEnvelope { const ApiEnvelope({required this.code, required this.message, this.data}); final int code; final String message; final Object? data; /// 从响应体解析信封;结构不符(非 JSON 对象 / 无 int code)返回 null。 static ApiEnvelope? tryParse(Object? body) { if (body is! Map) return null; final code = body['code']; if (code is! int) return null; return ApiEnvelope( code: code, message: body['message'] is String ? body['message'] as String : '', data: body['data'], ); } }