on<E> static method

_OfWidgetBuilder<E> on<E>({
  1. dynamic tag = #base,
  2. required _OfBuilderWithState<E> builder,
})

Definition

ObserverBuilder for watching changes on an object, by sending its Type.

Usage

To use this, you should first setup the provider for this type. Meaning that you should send the general instance of this type in KareeMaterialApp to watch in all your application.

  Observer.on<int>(
    builder: (ctx, counterObs) {
    return Text('general counter ${counterObs.value}');
  }),

See also Observer.withProviders

Implementation

static _OfWidgetBuilder<E> on<E>(
    {dynamic tag = #base, required _OfBuilderWithState<E> builder}) {
  return _OfWidgetBuilder<E>(
      of: PersistentContext.getObsWithTag<E>(tag), child: builder);
}