lukepighetti / fluro

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
https://pub.dev/packages/fluro
MIT License
3.66k stars 416 forks source link

Arguments is null when using HandlerType.function #265

Open 623637646 opened 2 years ago

623637646 commented 2 years ago

Add type: HandlerType.function to the example code in README.

FluroRouter.appRouter.navigateTo(
  context,
  'home',
  routeSettings: RouteSettings(
    arguments: MyArgumentsDataClass('foo!'),
  ),
);

var homeHandler = Handler(
  type: HandlerType.function,   // set function as the type.
  handlerFunc: (context, params) {
    final args = context.settings.arguments as MyArgumentsDataClass;  // args will be null.
    return HomeComponent(args);
  },
);

expected: args is MyArgumentsDataClass('foo!')

sbalex27 commented 2 years ago

I have the same problem