nubank / nuvigator

A powerful routing abstraction over Flutter Navigator, with nested Navigator and Deeplinks
Apache License 2.0
275 stars 33 forks source link

Dynamic module navigation #47

Closed netomarin closed 4 years ago

netomarin commented 4 years ago

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

leoiacovini commented 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:

I hope this clarification helps a bit :)

netomarin commented 4 years ago

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