import 'dart:convert'; /// 解析 JSON 字符串 StatLogEntry statLogEntryFromJson(String str) => StatLogEntry.fromJson(json.decode(str)); /// 序列化为 JSON 字符串 String statLogEntryToJson(StatLogEntry data) => json.encode(data.toJson()); class StatLogEntry { final String? id; final int? time; final String? level; final String? module; final String? category; final Fields? fields; StatLogEntry({ this.id, this.time, this.level, this.module, this.category, this.fields, }); factory StatLogEntry.fromJson(Map json) => StatLogEntry( id: json["id"], time: json["time"], level: json["level"], module: json["module"], category: json["category"], fields: json["fields"] == null ? null : Fields.fromJson(json["fields"]), ); Map toJson() => { "id": id, "time": time, "level": level, "module": module, "category": category, "fields": fields?.toJson(), }; } class Fields { final int? code; final String? boostSessionId; final bool? success; final int? locationId; final List? connectionHistory; final String? locationCode; final int? generatedTime; Fields({ this.code, this.boostSessionId, this.success, this.locationId, this.connectionHistory, this.locationCode, this.generatedTime, }); factory Fields.fromJson(Map json) => Fields( code: json["code"], boostSessionId: json["boostSessionId"], success: json["success"], locationId: json["locationId"], connectionHistory: json["connectionHistory"] == null ? [] : List.from( json["connectionHistory"]!.map( (x) => ConnectionHistory.fromJson(x), ), ), locationCode: json["locationCode"], generatedTime: json["generatedTime"], ); Map toJson() => { "code": code, "boostSessionId": boostSessionId, "success": success, "locationId": locationId, "connectionHistory": connectionHistory == null ? [] : List.from(connectionHistory!.map((x) => x.toJson())), "locationCode": locationCode, "generatedTime": generatedTime, }; } class ConnectionHistory { final String? firstHop; final int? duration; final String? address; final int? code; final int? startTime; final int? endTime; final String? nodeId; ConnectionHistory({ this.firstHop, this.duration, this.address, this.code, this.startTime, this.endTime, this.nodeId, }); factory ConnectionHistory.fromJson(Map json) => ConnectionHistory( firstHop: json["firstHop"], duration: json["duration"], address: json["address"], code: json["code"], startTime: json["startTime"], endTime: json["endTime"], nodeId: json["nodeId"], ); Map toJson() => { "firstHop": firstHop, "duration": duration, "address": address, "code": code, "startTime": startTime, "endTime": endTime, "nodeId": nodeId, }; }