ignoreUser method

Future<void> ignoreUser(
  1. String userId
)

Ignore another user. This will clear the local cached messages to hide all previous messages from this user.

Implementation

Future<void> ignoreUser(String userId) async {
  if (!userId.isValidSDNId) {
    throw Exception('$userId is not a valid mxid!');
  }
  await setAccountData(userID!, 'm.ignored_user_list', {
    'ignored_users': Map.fromEntries(
        (ignoredUsers..add(userId)).map((key) => MapEntry(key, {}))),
  });
  await clearCache();
  return;
}