ClientMsg constructor
ClientMsg(
- String type, {
- String? id,
- Nip01Event? event,
- List<
Filter> ? filters,
Implementation
ClientMsg(
this.type, {
this.id,
this.event,
this.filters,
}) {
// verify based on type
if (type == ClientMsgType.EVENT) {
if (event == null) {
throw Exception("event is required for type EVENT");
}
}
if (type == ClientMsgType.REQ) {
if (filters == null) {
throw Exception("filters are required for type REQ");
}
if (filters!.isEmpty) {
throw Exception("filters are required for type REQ");
}
if (id == null) {
throw Exception("id is required for type REQ");
}
}
if (type == ClientMsgType.CLOSE) {
if (id == null) {
throw Exception("id is required for type CLOSE");
}
}
if (type == ClientMsgType.COUNT) {
throw Exception("COUNT is not implemented yet");
}
}