Google is committed to advancing racial equity for Black communities. See how.

nextInstanceWithName method

*<Null safety>*

String nextInstanceWithName (String name)

Implementation

static String nextInstanceWithName(String name) {
  final _name = name.endsWith('.inspect') ? name : '$name.inspect';
  if (nameToInstanceCount.containsKey(_name)) {
    int val = nameToInstanceCount[_name]! + 1;
    nameToInstanceCount[_name] = val;
    return '${_name}_$val';
  } else {
    nameToInstanceCount[_name] = 1;
    return '$_name';
  }
}