NostrRequest.deserialized constructor
NostrRequest.deserialized(
- dynamic input
Deserialize a request
Implementation
factory NostrRequest.deserialized(input) {
assert(input.length >= 3, 'Invalid request, must have at least 3 elements');
assert(
input[0] == NostrConstants.request,
'Invalid request, must start with ${NostrConstants.request}',
);
final subscriptionId = input[1];
return NostrRequest(
subscriptionId: subscriptionId,
filters: List.generate(
input.length - 2,
(index) => NostrFilter.fromJson(
input[index + 2],
),
),
);
}