removePubRootDirectories method Null safety

  1. @protected
void removePubRootDirectories(
  1. List<String> pubRootDirectories
)
protected">@protected

Remove a list of directories that should no longer be considered part of the local project.

The local project directories are used to distinguish widgets created by the local project from widgets created from inside the framework or other packages.

Implementation

@protected
void removePubRootDirectories(List<String> pubRootDirectories) {
  if (_pubRootDirectories == null) {
    return;
  }
  pubRootDirectories = pubRootDirectories.map<String>((String directory) => Uri.parse(directory).path).toList();

  final Set<String> directorySet = Set<String>.from(_pubRootDirectories!);
  directorySet.removeAll(pubRootDirectories);

  _pubRootDirectories = directorySet.toList();
  _isLocalCreationCache.clear();
}