rel<T extends DataClass> method

DataSet<T> rel<T extends DataClass>(
  1. String relationName, {
  2. dynamic parentId,
  3. bool clear = true,
})

Returns the dataset that was stored as a child under the relation name passed as parameter

Implementation

DataSet<T> rel<T extends DataClass>(String relationName, {dynamic parentId, bool clear = true}) {
  if (_children[relationName] == null) throw Exception();
  var child = _children[relationName] as DataSet<T>;
  child.updateRoute(child._initialRoute);
  if (parentId != null) {
    child.updateRoute(child._route.replaceAll(':parentId', parentId));
  }
  if (clear) {
    child.clearList();
    child.clearModel();
    child.local = {};
    child.localViews = {};
  }
  return child;
}