normalizeObjectID method

  1. @protected
String normalizeObjectID(
  1. Object? o
)
inherited

Normalizes the object ID o into a safe file/object name: only word characters, . and -, no leading . (no hidden files, nor ..), and at most 220 characters (below the usual file name limits).

Implementation

@protected
String normalizeObjectID(Object? o) {
  var id = o?.toString() ?? '';
  if (id.isEmpty) {
    throw StateError("Empty ID string.");
  }

  id = id
      .replaceAll(_regExpNormalizeIDInvalidChars, '')
      .replaceAll(_regExpNormalizeIDInvalidPrefix, '');
  id = id.truncate(220);
  return id;
}