Injected<T>.generic constructor

Injected<T>.generic({
  1. required Object? creator(),
  2. required T? initialState,
  3. required SideEffects<T>? sideEffects,
  4. required StateInterceptor<T>? stateInterceptor,
  5. required bool autoDisposeWhenNotUsed,
  6. required String? debugPrintWhenNotifiedPreMessage,
  7. required Object? toDebugString(
    1. T?
    )?,
  8. required int undoStackLength,
  9. required PersistState<T> persist()?,
  10. required DependsOn<T>? dependsOn,
  11. Object? watch(
    1. T? s
    )?,
})

Create an Injected state from any kind of creator

Implementation

factory Injected.generic({
  required Object? Function() creator,
  required T? initialState,
  required SideEffects<T>? sideEffects,
  required StateInterceptor<T>? stateInterceptor,
  required bool autoDisposeWhenNotUsed,
  required String? debugPrintWhenNotifiedPreMessage,
  required Object? Function(T?)? toDebugString,
  required int undoStackLength,
  required PersistState<T> Function()? persist,
  required DependsOn<T>? dependsOn,
  Object? Function(T? s)? watch,
}) =>
    undoStackLength > 0 || persist != null
        ? InjectedImpRedoPersistState<T>(
            creator: creator,
            initialState: initialState,
            sideEffects: sideEffects,
            stateInterceptor: stateInterceptor,
            autoDisposeWhenNotUsed: autoDisposeWhenNotUsed,
            debugPrintWhenNotifiedPreMessage:
                debugPrintWhenNotifiedPreMessage,
            toDebugString: toDebugString,
            undoStackLength: undoStackLength,
            persist: persist,
            dependsOn: dependsOn,
            watch: watch,
          )
        : InjectedImp<T>(
            creator: creator,
            initialState: initialState,
            sideEffectsGlobal: sideEffects,
            stateInterceptor: stateInterceptor,
            autoDisposeWhenNotUsed: autoDisposeWhenNotUsed,
            debugPrintWhenNotifiedPreMessageGlobal:
                debugPrintWhenNotifiedPreMessage,
            toDebugString: toDebugString,
            dependsOn: dependsOn,
            watch: watch,
          );