import 'package:json_annotation/json_annotation.dart'; part 'udp_package.g.dart'; @JsonSerializable() class UdpPackage { final String id; final String name; final String data; final String ipAddress; UdpPackage({ required this.id, required this.name, required this.data, required this.ipAddress, }); factory UdpPackage.fromJson(Map json) => _$UdpPackageFromJson(json); Map toJson() => _$UdpPackageToJson(this); UdpPackage copyWith({ String? id, String? name, String? data, String? ipAddress, }) { return UdpPackage( id: id ?? this.id, name: name ?? this.name, data: data ?? this.data, ipAddress: ipAddress ?? this.ipAddress, ); } }