Closed netomarin closed 4 years ago
Hey @netomarin how are you doing?
You probably are going to run into some static analysis/compilation problems by having the dependencies not available, but the imports present in the main application. Right now Nuvigator itself does not provide any way of doing what you want (and I don't see an obvious way it could given that this is really dependent of a per-project configuration).
What I can suggest are the following options:
You can write yourself a code generation script for your project that would create the file with imports and Routers composition based on the content of the your pubspec.yaml
You always have all the dependencies present, but conditionally includes they in your root Router using some build configuration flag/environment variable (the code of all the dependencies will be bundled in the app, if this is not a problem for you)
I hope this clarification helps a bit :)
Hey @leoiacovini thanks for the quick reply. Yes, it makes sense. I was trying another approach, generating the routes according to the modules.
I think I will create an Interface to return the routes, and implement this interface with the Router on a generated file. It should work, since it will have only the expected modules and routes.
Thanks
Hey Nuvigator team,
I'm trying to extend the lib, but my limited knowledge about Flutter / Dart is blocking me.
I have a "base" application, where I gonna have only configuration setup and two screens (settings and about). All the other features are distributed in different packages (or modules), for example
FeedModule
,ScheduleModule
,FormModule
, etc.Based on a build script, I gonna change
pubspec.yaml
to add as dependency only the modules I need for that build. So, I can generate different apps with different modules arrangements.For each module, I created the its own Router with all navigation logic for that module. But I can't do the Router for the main application because I don't know beforehand which module is included.
Is it possible somehow to have the Router implementation creating code for the routes after processing the packaged included in the build?
Thanks Neto