I am making an application with different modules managing it with flutter_modular but I cannot access in some dynamic way the routes of the different modules.
class MainModule extends Module {
final List<ModuleRoute> _moduleRoutes = [
ModuleRoute('/inicio/', module: InicioModule()),
ModuleRoute('/empleados/', module: EmpleadosModule()),
ModuleRoute('/inventario/', module: InventarioModule()),
];
List<ModuleRoute> get moduleRoutes => _moduleRoutes;
@override
void binds(i) {
}
@override
void routes(r) {
r.child('/',
child: (context) => const MainPage(),
children: _moduleRoutes,
transition: TransitionType.fadeIn);
}
}```
The objective is to obtain all the child routes that are used inside the different modules to be able to dynamically generate the navigation menu.
I have tried to access the instances of the modules but always find the values of the empty routes although the application is working.
It is the first time I make a post, if there is missing information or if someone could help me I would appreciate it very much. Thank you!
Fremy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.