OnBuilder<T>.create constructor

OnBuilder<T>.create({
  1. Key? key,
  2. @Deprecated('Use creator instead') ReactiveModel<T> create()?,
  3. T creator()?,
  4. SideEffects<T>? sideEffects,
  5. required Widget builder(
    1. ReactiveModel<T> rm
    ),
})

If creator is null, a ReactiveModel

Implementation

OnBuilder.create({
  Key? key,
  @Deprecated('Use creator instead') ReactiveModel<T> Function()? create,
  T Function()? creator,
  SideEffects<T>? sideEffects,
  required Widget Function(ReactiveModel<T> rm) builder,
}) : super(
        key: key,
        observers: (_) => [
          creator != null
              ? ReactiveModel<T>.create(
                  creator: creator,
                  initialState: null,
                  autoDisposeWhenNotUsed: true,
                ) as ReactiveModelImp<T>
              : create != null
                  ? create() as ReactiveModelImp<T>
                  : ReactiveModel<T>.create(
                      creator: () => null,
                      initialState: null,
                      autoDisposeWhenNotUsed: true,
                    ) as ReactiveModelImp<void>,
        ],
        builder: (_, __, rm) => builder(rm),
        sideEffects: sideEffects,
      );