editMessage method
Updates updated on the backend.
messageId is the local/remote ID of the message to replace.
Implementation
@override
Future<DeliveryStatus> editMessage(String messageId, Message updated) async {
try {
final res = await http.put(
'${config.baseUrl}/messages/$messageId',
body: jsonEncode({'payload': updated.payload.toJson()}),
headers: config.defaultHeaders,
);
return res.isOk
? DeliveryStatus.ok(messageId)
: DeliveryStatus.fail('HTTP ${res.statusCode}');
} catch (e) {
return DeliveryStatus.fail(e.toString());
}
}