Scenario<TWidget extends Widget, TArgs extends StoryArgs<TWidget>> class

Inheritance

Constructors

Scenario({ScenarioType type = ScenarioType.local, required String name, List<Mode>? modes, TArgs? args, Future<void> run(WidgetTester tester, TArgs args)?, bool excludeFromTests = false, ModesMerger mergeModes = defaultMergeModes})

Properties

args → TArgs
no setter
excludeFromTests bool
Whether to exclude this scenario from snapshot generation in testWidgetbook.
final
hashCode int
The hash code for this object.
no setterinherited
mergeModes ModesMerger
A function to merge the modes defined in the story and the ones defined in this Scenario or ScenarioDefinition.
finalinherited
modes List<Mode>
Combines the modes defined in the story and the ones defined in this scenario. If both are null, returns null.
no setteroverride
name String
finalinherited
path String
no setter
run Future<void> Function(WidgetTester tester, TArgs args)?
A function that is executed during the test after the widget is built and before the screenshot is taken. It can be used to interact with the widget, e.g. to open a dropdown or to trigger an animation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
story Story<TWidget, TArgs>
A late back-reference to the story this scenario belongs to. It is initialized in the Story constructor.
latefinal
strategy ScenarioStrategy
How this definition is expanded into Scenarios for each Story.
finalinherited
type ScenarioType
final
viewport ViewportData?
Gets the viewport from the modes if a ViewportMode is present. Otherwise, returns null.
no setter

Methods

buildWithConfig(BuildContext context, Config config) Widget
Injects both modes and args into the built story.
execute(WidgetTester tester) Future<void>?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited