import 'package:freezed_annotation/freezed_annotation.dart'; part 'packet.g.dart'; @JsonSerializable() class NetworkPackage { @JsonKey(name: 'w', defaultValue: 'unknown') String method; @JsonKey(name: 'e') String? endpoint; @JsonKey(name: 'm') String? message; @JsonKey(name: 'p') Map? payload; NetworkPackage({ required this.method, this.endpoint, this.message, this.payload, }); factory NetworkPackage.fromJson(Map json) => _$NetworkPackageFromJson(json); Map toJson() => _$NetworkPackageToJson(this); }