Surface/lib/types/websocket.dart

18 lines
557 B
Dart
Raw Normal View History

2024-11-14 16:24:46 +00:00
import 'package:freezed_annotation/freezed_annotation.dart';
part 'websocket.freezed.dart';
part 'websocket.g.dart';
@freezed
class WebSocketPackage with _$WebSocketPackage {
const factory WebSocketPackage({
@JsonKey(name: 'w') @Default('unknown') String method,
@JsonKey(name: 'e') String? endpoint,
@JsonKey(name: 'm') String? message,
@JsonKey(name: 'p') @Default({}) Map<String, dynamic>? payload,
}) = _WebSocketPackage;
factory WebSocketPackage.fromJson(Map<String, dynamic> json) =>
_$WebSocketPackageFromJson(json);
}