prepare method Null safety

  1. @override
void prepare()
override

used to allow for custom configuration to ensure framework specific configuration is in place

Implementation

@override
void prepare() {
  _ensureCorrectConfiguration();
  final providedCreateWorld = createWorld;
  createWorld = (config) async {
    FlutterWorld? world;
    if (providedCreateWorld != null) {
      world = (await providedCreateWorld(config)) as FlutterWorld;
    }

    return await createFlutterWorld(config, world);
  };

  hooks = List.from(hooks ?? <Hook>[])..add(FlutterAppRunnerHook());
  customStepParameterDefinitions =
      List.from(customStepParameterDefinitions ?? <CustomParameter>[])
        ..addAll([
          ExistenceParameter(),
          SwipeDirectionParameter(),
        ]);
  stepDefinitions = List.from(stepDefinitions ?? <StepDefinitionGeneric>[])
    ..addAll([
      ThenExpectElementToHaveValue(),
      WhenTapBackButtonWidget(),
      WhenTapWidget(),
      WhenTapWidgetWithoutScroll(),
      WhenLongPressWidget(),
      WhenLongPressWidgetWithoutScroll(),
      WhenLongPressWidgetForDuration(),
      GivenOpenDrawer(),
      WhenPauseStep(),
      WhenFillFieldStep(),
      ThenExpectWidgetToBePresent(),
      RestartAppStep(),
      SiblingContainsTextStep(),
      SwipeOnKeyStep(),
      SwipeOnTextStep(),
      TapTextWithinWidgetStep(),
      TapWidgetOfTypeStep(),
      TapWidgetOfTypeWithinStep(),
      TapWidgetWithTextStep(),
      TextExistsStep(),
      TextExistsWithinStep(),
      WaitUntilKeyExistsStep(),
      WaitUntilTypeExistsStep(),
    ]);
}