formatDigitPattern method
Add pattern every x bits
Implementation
String formatDigitPattern({int digit = 4, String pattern = ' '}) {
String text = this;
text = text.replaceAllMapped(
RegExp('(.{$digit})'), (Match match) => '${match.group(0)}$pattern');
if (text.endsWith(pattern)) {
text = text.substring(0, text.length - 1);
}
return text;
}