query static method

AsyncReply<List<IResource>?> query(
  1. String? path
)

Implementation

static AsyncReply<List<IResource>?> query(String? path) {
  if (path == null || path == "") {
    var roots =
        _stores.where((s) => s.instance?.parents.length == 0).toList();
    return new AsyncReply<List<IResource>?>.ready(roots);
  } else {
    var rt = new AsyncReply<List<IResource>>();
    get(path).then((x) {
      var p = path.split('/');

      if (x == null) {
        rt.trigger(qureyIn(p, 0, _stores));
      } else {
        var ar = qureyIn(p, 0, _stores).where((r) => r != x).toList();
        ar.insert(0, x);
        rt.trigger(ar);
      }
    });

    return rt;
  }
}