generate method

  1. @override
String? generate(
  1. String uri, {
  2. bool noPrefix = false,
})
override

Implementation

@override
String? generate(String uri, {bool noPrefix = false}) {
  if (uri.isEmpty) return null;
  if (namespaces.containsKey(uri)) return getPrefix(uri);
  final prefix = _genNextPrefix(noPrefix);
  if (reversedCache.containsKey(prefix)) return null;
  namespaces[uri] = prefix;
  reversedCache[prefix] = uri;
  return prefix;
}