call method

String call(
  1. String prefix
)

A name of the form prefix_N that is not in use and has not been issued before.

Implementation

String call(String prefix) {
  final taken = {..._existingNames(), ..._issued};
  var index = 0;
  var candidate = '${prefix}_$index';
  while (taken.contains(candidate)) {
    index++;
    candidate = '${prefix}_$index';
  }
  _issued.add(candidate);
  return candidate;
}