WidgetModel constructor

WidgetModel(
  1. WidgetModel? parent,
  2. String? id, {
  3. Scope? scope,
})

Implementation

WidgetModel(WidgetModel? parent, String? id, {Scope? scope})
{
  // default id
  if (S.isNullOrEmpty(id)) id = S.newId();
  this.id = id!;

  // set the parent
  this.parent = parent;

  // set the scope
  this.scope = scope ?? Scope.of(this);

  // set the framework
  this.framework = findAncestorOfExactType(FrameworkModel);

  // register the model with the scope
  if (!S.isNullOrEmpty(id) && this.scope != null) this.scope!.registerModel(this);
}