slugify static method

String slugify(
  1. String name
)

Turns a human readable name into a usable key.

Keys end up in task.job references on the command line, so a dot or a space in one would make the reference ambiguous.

Implementation

static String slugify(String name) {
  final slug = name
      .toLowerCase()
      .replaceAll(RegExp(r"[^a-z0-9]+"), '_')
      .replaceAll(RegExp(r'^_+|_+$'), '');
  return slug;
}