Solian/lib/models/packet.dart

28 lines
602 B
Dart
Raw Normal View History

2024-09-16 18:14:23 +00:00
import 'package:json_annotation/json_annotation.dart';
part 'packet.g.dart';
@JsonSerializable()
2024-05-18 10:17:16 +00:00
class NetworkPackage {
2024-09-16 11:50:49 +00:00
@JsonKey(name: 'w', defaultValue: 'unknown')
2024-05-18 10:17:16 +00:00
String method;
@JsonKey(name: 'e')
2024-08-23 14:43:04 +00:00
String? endpoint;
@JsonKey(name: 'm')
2024-05-18 10:17:16 +00:00
String? message;
@JsonKey(name: 'p')
2024-05-18 10:17:16 +00:00
Map<String, dynamic>? payload;
NetworkPackage({
required this.method,
2024-08-23 14:43:04 +00:00
this.endpoint,
2024-05-18 10:17:16 +00:00
this.message,
this.payload,
});
factory NetworkPackage.fromJson(Map<String, dynamic> json) =>
_$NetworkPackageFromJson(json);
2024-05-18 10:17:16 +00:00
Map<String, dynamic> toJson() => _$NetworkPackageToJson(this);
2024-05-18 10:17:16 +00:00
}