getUniqueId method

String getUniqueId(
  1. String? id
)

Implementation

String getUniqueId(String? id) {
  // user supplied id
  if (!isNullOrEmpty(id)) return id!;

  // auto generated id
  String prefix = "auto";
  if (kDebugMode) {
    prefix = "$runtimeType";
    prefix = prefix.replaceAll(onlyAlpha, '');
    if (prefix.endsWith('model')) {
      prefix = prefix.substring(0, prefix.lastIndexOf('model'));
    }
  }
  return newId(prefix: prefix);
}