getAsReactive<T> static method

ReactiveModel<T> getAsReactive<T>({
  1. dynamic name,
  2. bool silent = false,
})

Get the singleton ReactiveModel instance of a model registered with Injector.

Implementation

static ReactiveModel<T> getAsReactive<T>({
  dynamic name,
  bool silent = false,
}) {
  final String _name = name == null ? '$T' : name.toString();

  final Inject<T> inject = _getInject<T>(_name, silent);

  final reactiveModel = inject.injected;
  // assert(
  //   () {
  //     if (reactiveModel.state is StatesRebuilder) {
  //       throw Exception(
  //         'Injected model extends StatesRebuilder',
  //       );
  //     }
  //     return true;
  //   }(),
  // );

  return reactiveModel;
}