WidgetModel constructor

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

Implementation

WidgetModel(this.parent, String? id, {Scope? scope, dynamic data}) {
  // set the id
  this.id = getUniqueId(id);

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

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

  // set the data
  if (data != null) this.data = data;

  // register the model
  this.scope?.registerModel(this);
}