2024-09-07 07:36:06 +00:00
|
|
|
import 'package:freezed_annotation/freezed_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;
|
2024-09-07 07:36:06 +00:00
|
|
|
@JsonKey(name: 'e')
|
2024-08-23 14:43:04 +00:00
|
|
|
String? endpoint;
|
2024-09-07 07:36:06 +00:00
|
|
|
@JsonKey(name: 'm')
|
2024-05-18 10:17:16 +00:00
|
|
|
String? message;
|
2024-09-07 07:36:06 +00:00
|
|
|
@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,
|
|
|
|
});
|
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
factory NetworkPackage.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$NetworkPackageFromJson(json);
|
2024-05-18 10:17:16 +00:00
|
|
|
|
2024-09-07 07:36:06 +00:00
|
|
|
Map<String, dynamic> toJson() => _$NetworkPackageToJson(this);
|
2024-05-18 10:17:16 +00:00
|
|
|
}
|