static int countReplacements(String text) { return text.codeUnits .where( (int u) => u == ChipsInputEditingController.kObjectReplacementChar) .length; }