getDependencies method

dynamic getDependencies(
  1. dynamic type
)

Requests all dependencies of the specified type asynchronously, with caching. @param {string} type @return {Promise<Array

Implementation

getDependencies(type) async {
  var dependencies = this.cache.get(type);

  if (dependencies != null) {
    return dependencies;
  }

  var parser = this;
  var defs = this.json[type + (type == 'mesh' ? 'es' : 's')] ?? [];

  List _dependencies = [];

  int l = defs.length;

  for (var i = 0; i < l; i++) {
    var _dep = await parser.getDependency(type, i);
    _dependencies.add(_dep);
  }

  this.cache.add(type, _dependencies);

  return _dependencies;
}