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.67k stars 417 forks source link

Error: The argument type 'FluroRouter' can't be assigned to the parameter type 'Router<dynamic>' #278

Closed suraj740 closed 1 year ago

suraj740 commented 1 year ago

Hi @lukef , i am using fluro router 2.0.0 , i am getting below errors,

  1. Error: The argument type 'FluroRouter' can't be assigned to the parameter type 'Router'.
  2. Error: A value of type 'FluroRouter' can't be assigned to a variable of type 'Router?'.
  3. The getter 'generator' isn't defined for the class 'Router
class Test extends StatelessWidget {
  Test({Key? key}) : super(key: key) {
    final router = FluroRouter();
    Routes.configureRoutes(router); // 1.
    Application.router = router; // 2.
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Test',
      theme: ThemeData(
        fontFamily: 'GoogleSans',
        primaryColor: Colors.black,
      ),
      onGenerateRoute: Application.router.generator, // 3.
      home: Home(),
    );
  }
}

Any help would be appreciated!

suraj740 commented 1 year ago

Found the issue Router class from flutter was used instead of FluroRouter in Routes and Application classes.