replaceData static method

String replaceData({
  1. required String text,
})

Implementation

static String replaceData({
  required String text,
}) {
  String text_result = text;
  List<RegExpReplace> regxs = [
    RegExpReplace(
      from: RegExp(r"([0-9]{8,10}:[a-zA-Z0-9_-]{35})", caseSensitive: false),
      replace: (match) {
        return "Secret Token Bot";
      },
    )
  ];

  for (RegExpReplace regExpReplace in regxs) {
    text_result = text_result.replaceAllMapped(
        regExpReplace.from, regExpReplace.replace);
  }
  return text_result;
}