checkIfTrackerPlacedCausesDuplication method

void checkIfTrackerPlacedCausesDuplication(
  1. int start,
  2. TextEditingController textEditingController
)

Implementation

void checkIfTrackerPlacedCausesDuplication(
    int start, TextEditingController textEditingController) {
  if (mentionedUsersMap.isNotEmpty) {
    mentionedUsersMap.forEach((key, value) {
      var matches = RegExp(key).allMatches(textEditingController.text);
      if (matches.length > value.length) {
        for (int i = 0; i < matches.length; i++) {
          if (matches.elementAt(i).start == start) {
            mentionedUsersMap[key]!.insert(i, null);

            conflictingIndex = i;
            break;
          }
        }
      }
    });
  }
}