withProviders static method

Widget withProviders({
  1. required List<Of> providers,
  2. required _OfBuilder child,
})

Definition

Observer.withProviders method is used to register objects to observe in your application.

Usage

To use this, just provide all observable instances and a widgetBuilder.

   Observer.withProviders(
      providers: [Of(User(firstName: 'Mark', lastName: 'Ngourtchou'))],
      child: (ctx) {
        return Scaffold(
          body: Observe.on<User>(
            builder: (ctx, userObs) =>
              Text(
                'Welcome ${userObs.value.firstName}'
                ' ${userObs.value.lastName}')
          )
        );
      }
    )

See also Observer.withProviders

Implementation

static Widget withProviders(
    {required List<Of> providers, required _OfBuilder child}) {
  return _OfWidgetProvider(obs: providers, child: child);
}