Search code examples
fluttergoogle-cloud-firestorematerialpageroute

Get MaterialPageRoute from Firestore - Flutter


I don't know whether it's possible or not but I want to get the new page for my navigator from the firestore database. Let me explain:

I have the following code:

onTap: () {
   Navigator.of(context).push(MaterialPageRoute(
   builder: (context) => Example()));
                      },

I don't want to have a fixed page here like "Example()". I want to get the information on which page I have to use somewhere from my database. Is that possible? Thanks for your answers. You're great :)


Solution

    • In Flutter, the way to send data to a new screen is described here.
    • A simple use case of flutter navigation using MaterialPageRouter is listed here.
    • However, I found this SO post which might seem useful for your use-case.
    • You may try BLoC implementation here. Furthermore, I came across this BLoC article that might shed some light on this issue.