def _collect_transitive_deps(deps):
  """Collects transitive closure of deps.

  Args:
    deps: input deps Target collection. All targets must have a 'dart' provider.

  Returns:
    Transitive closure of deps.
  """
  transitive_deps = {}
  for dep in deps:
    transitive_deps.update(dep.dart.transitive_deps)
    transitive_deps["%s" % dep.dart.label] = dep
  return transitive_deps