redactEvent method

Future<String?> redactEvent(
  1. String eventId, {
  2. String? reason,
  3. String? txid,
})

Redacts this event. Throws ErrorResponse on error.

Implementation

Future<String?> redactEvent(String eventId,
    {String? reason, String? txid}) async {
  // Create new transaction id
  String messageID;
  final now = DateTime.now().millisecondsSinceEpoch;
  if (txid == null) {
    messageID = 'msg$now';
  } else {
    messageID = txid;
  }
  final data = <String, dynamic>{};
  if (reason != null) data['reason'] = reason;
  return await client.redactEvent(
    id,
    eventId,
    messageID,
    reason: reason,
  );
}