toUserName static method
Converts a username by applying regex and replacements.
Example: ('John Doe', regexList: ' '
, replacements: '_'
) -> 'john_doe'
Implementation
static String toUserName(
String name, {
List<String>? regexList,
List<String>? replacements,
}) {
final String current = Replacement.auto(name).toLowerCase();
if (replacements != null) {
return Replacement.multiple(current, replacements, regexList ?? []);
} else {
return Replacement.single(current, "", regexList);
}
}