DisplayApp.singleUseCase constructor
DisplayApp.singleUseCase({
- required AppConfig appConfig,
- required AddonConfig addonConfig,
- required UseCaseDescriptor useCase,
- UseCaseStateMutation? initialMutation,
- WrapperBuilder? useCaseWrapper,
A convenience constructor to create a DisplayApp with a UseCaseDisplay as child.
The appConfig and addonConfig parameters are passed to the
DisplayApp.
The useCase and initialMutation parameters are passed to the
UseCaseDisplay.
The useCaseWrapper parameter can be used to wrap the
UseCaseDisplay, effectively inserting a widget between it and the
DisplayApp.
Implementation
factory DisplayApp.singleUseCase({
required AppConfig appConfig,
required AddonConfig addonConfig,
required UseCaseDescriptor useCase,
UseCaseStateMutation? initialMutation,
WrapperBuilder? useCaseWrapper,
}) {
final useCaseDisplay = UseCaseDisplay(
useCase: useCase,
initialMutation: initialMutation,
);
final Widget effectiveUseCaseDisplay;
if (useCaseWrapper != null) {
effectiveUseCaseDisplay = Builder(
builder: (context) {
return useCaseWrapper(
context,
useCaseDisplay,
);
},
);
} else {
effectiveUseCaseDisplay = useCaseDisplay;
}
return DisplayApp(
appConfig: appConfig,
addonConfig: addonConfig,
child: effectiveUseCaseDisplay,
);
}