Solian/lib/models/packet.dart
2024-09-16 19:50:49 +08:00

28 lines
608 B
Dart

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<String, dynamic>? payload;
NetworkPackage({
required this.method,
this.endpoint,
this.message,
this.payload,
});
factory NetworkPackage.fromJson(Map<String, dynamic> json) =>
_$NetworkPackageFromJson(json);
Map<String, dynamic> toJson() => _$NetworkPackageToJson(this);
}