decodeRequest static method
Decode document request
Implementation
static DocumentRequest decodeRequest(Uint8List bytes) {
final json = utf8.decode(bytes);
final data = jsonDecode(json) as Map<String, dynamic>;
final headers = data['headers'] != null
? Map<String, String>.from(data['headers'] as Map)
: <String, String>{};
final body = data['body'] != null
? base64Decode(data['body'] as String)
: null;
return DocumentRequest(
operation: data['operation'] as String,
ownerPeerId: PeerId.fromString(data['ownerPeerId'] as String),
path: data['path'] as String,
headers: headers,
body: body,
);
}