gurleensethi / sailor

Easy page navigation and management in Flutter apps.
https://pub.dev/packages/sailor
MIT License
145 stars 24 forks source link

Example rising analysis warning: avoid_classes_with_only_static_members #22

Closed talamaska closed 4 years ago

talamaska commented 4 years ago

Is it possible to actually have the createRoutes function not as static method? If I do this, I just have to change in my main.dart to call Router().createRoutes(); instead of Router.createRoutes(), and it seems it's still working fine. Not sure i understand the implications.

UADACID commented 4 years ago

I also want to know the same thing because I use dynamic route from list

gurleensethi commented 4 years ago

Hey, its up to you if you want to use a static method or not. Just make sure to use the same Sailor instance throughout the application, because if you create a new Sailor instance from within the app, it will not have all the routes registered to it.

IMO, keep the Routes class static, or use singleton pattern, or any other method that makes sure that you will be using the same Sailor instance.