Pub constructor

Pub()

Implementation

Pub() : publish = dummyCallback {
  assert(() {
    if (Host.stateModels[runtimeType] != null) {
      throw FlutterError('Duplicate model type of <$runtimeType>');
    }
    return true;
  }());

  /// class initial steps
  /// 1. rx variables initial
  /// 2. model extends from Pub and initial
  /// 3. set the Pub of rx variables with this pub(model)
  RxImpl.setPub(this);

  // runtimeType == 'Pub' is the globalPub
  assert(() {
    if (runtimeType.toString() != 'Pub') {
      debugPrint('RxImpl set pub to: $this');
    }
    return true;
  }());

  Host.stateModels[runtimeType] = this;
  init();
}