How to use CustomRoute
I used the same class of the transitionBuilder in the auto route it used to work until i migrated to the null saftey packege
AutoRoute isn't compatible with stacked anymore. Stacked has its own router functionality that you can see in this video
Yes i know , i migrated to the stacked route and using the stacked generator but couldn't find any documentation on the customRoute
It's the same as the AutoRoute one. I moved the code over from AutoRoute into stacked. I'll add some documentation when I get some time.
You forgot about the TransitionsBuilders class so i add it in my project it used to work before the null saftey but it won't work anymore I don't know why
stacked/src/code_generation/router/transitions_builders.dart i can't use this class not the same as auto route is there a different way?

I faced the same problem,
CustomRoute( page: TestView, transitionsBuilder: TransitionsBuilders.fadeIn, ), CustomRoute( page: UpdateNoteView, transitionsBuilder: TransitionsBuilders.zoomIn, ), CustomRoute( page: TestGallery, transitionsBuilder: TransitionsBuilders.slideRightWithFade, ),
i can't use anymore
@FilledStacks
Discovered that NavigationService has replaceWithTransition and navigateWithTransition methods but both require the actual Views instead of Routes. Moreover, I tested the built-in transition animations that came with the methods and some of them were buggy (fade transition, which I need for my project, seems to just be the regular Material transition). Just wanted to raise this even though it is a minor/cosmetic issue.
Maybe it's not exported. Let me check if it's still there in the package. I never built any of this in directly.
I just added the transition builders to the exports in stacked.dart. You should be able to import now @okursoftware
Using custom route gives this error:
[SEVERE] stacked_generator:stackedRouterGenerator on lib/app/router.dart:
type 'Null' is not a subtype of type 'String'
Here is the configuration:
@StackedApp(
routes: [
CustomRoute(
page: SplashView,
initial: true,
transitionsBuilder: TransitionsBuilders.slideRightWithFade,
durationInMilliseconds: 300,
),
]
)
class App {}
What's interesting is that the issue only happens with CustomRoute.
Using custom route gives this error:
[SEVERE] stacked_generator:stackedRouterGenerator on lib/app/router.dart: type 'Null' is not a subtype of type 'String'Here is the configuration:
@StackedApp( routes: [ CustomRoute( page: SplashView, initial: true, transitionsBuilder: TransitionsBuilders.slideRightWithFade, durationInMilliseconds: 300, ), ] ) class App {}What's interesting is that the issue only happens with CustomRoute.
So it's not just me 😂😂😂 If you don't add the transitionBuilders it works but then what is the use without it
CustomRoute(page: LoginView,transitionsBuilder: TransitionsBuilders.zoomIn),
The import problem is solved, but,
I encountered such an error when I ran build_runner
[SEVERE] stacked_generator:stackedRouterGenerator on lib/app/app.dart:
NoSuchMethodError: The method 'startsWith' was called on null.
Receiver: null
Tried calling: startsWith("dart")
@FilledStacks How do we add custom TransitionBuilders? I tried to add but the generated app.router.dart file is not importing the custom transition builder file.
@FilledStacks How do we add custom TransitionBuilders? I tried to add but the generated
app.router.dartfile is not importing the custom transition builder file.
@FilledStacks can you take a look at this please?
@calebdeji we don't have custom transition builders. We will be working on that for Stacked v3
@FilledStacks, please make sure I can add my ModalsPageRoute.
Like this
Route<T> modalsPageRoute<T>(
BuildContext context,
Widget child,
CustomPage<T> page,
) {
return MaterialWithModalsPageRoute(
fullscreenDialog: page.fullscreenDialog,
settings: page,
builder: (_) => child,
);
}
CustomRoute(
customRouteBuilder: modalsPageRoute,
path: '/profile',
page: ProfilePage,
),
@ziqq you can make sure and then tell me if you can't.
The doc for this functionality has been created.