addPrototype method

AFSingleScreenPrototypeBody addPrototype({
  1. required AFPrototypeID id,
  2. required dynamic stateView,
  3. required AFNavigatePushAction? navigate,
  4. required AFNavigateWithOnEventContextDelegate? navigateWithEventContext,
  5. required AFTestTimeHandling timeHandling,
})

Add a prototype of a particular screen with the specified stateView and an initial route parameter from navigate.

Returns an AFSingleScreenPrototypeBody, which can be used to create a test for the screen.

Implementation

AFSingleScreenPrototypeBody addPrototype({
  required AFPrototypeID   id,
  required dynamic stateView,
  required AFNavigatePushAction? navigate,
  required AFNavigateWithOnEventContextDelegate? navigateWithEventContext,
  required AFTestTimeHandling timeHandling
}) {
  final instance = AFSingleScreenPrototype(
    id: id,
    stateView: stateView,
    navigate: navigate,
    navigateWithEventContext: navigateWithEventContext,
    body: AFSingleScreenPrototypeBody(id, screenIdCreator: () {
      final nav = AFScreenPrototype.createNavigatePushStatic(
        navigate: navigate,
        navigateWithEventContext: navigateWithEventContext,
        stateView: stateView
      );

      return nav.screenId;
    }),
    timeHandling: timeHandling
  );
  _singleScreenTests.add(instance);
  return instance.body;
}