DecoratorRule.between constructor

DecoratorRule.between({
  1. required String start,
  2. required String end,
  3. required TextStyle style,
  4. dynamic onTap(
    1. String
    )?,
  5. bool removeMatchingCharacters = false,
  6. bool caseSensitive = false,
})

Implementation

factory DecoratorRule.between({
  required String start,
  required String end,
  required TextStyle style,
  Function(String)? onTap,
  bool removeMatchingCharacters = false,
  bool caseSensitive = false,
}) {
  return DecoratorRule(
    style: style,
    regExp: CommonRegExp.between(
      start: start,
      end: end,
      caseSensitive: caseSensitive,
    ),
    onTap: onTap,
    transformMatch: (match) {
      if (removeMatchingCharacters) {
        String res = match;
        res = res.replaceFirst(start, "");
        res = res.replaceFirst(end, "");
        return res;
      }
      return match;
    },
  );
}