-
Notifications
You must be signed in to change notification settings - Fork 415
Open
Description
I have url : www.foobar.com/template/1234&token=1234 where the first 1234 is the template id. here is my code:
class CustomRouter {
static FluroRouter router = FluroRouter();
static final Handler _splashPage = Handler(
handlerFunc: ((context, parameters) {
return const SplashPage();
}),
);
static final Handler _templatePageHandler = Handler(
handlerFunc: ((context, parameters) {
String templateId = parameters['tID']!.first;
return const TemplatePage(templateId: templateId);
}),
);
static void defineRoutes() {
router.define("/", handler: _splashPage);
router.define(
"/template/:templateId",
handler: _templatePageHandler,
transitionType: TransitionType.fadeIn,
);
}
}
and the app.dart is as:
class App extends StatefulWidget {
const App({Key? key}) : super(key: key);
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
@override
void initState() {
super.initState();
CustomRouter.defineRoutes();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Name",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
onGenerateRoute: CustomRouter.router.generator,
);
}
}
Throws an Expected a value of type 'Handler', but got one of type 'Null'. When I tried running the same code but without the :templateId it works fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels