toPath method

  1. @override
String toPath()
override

Define a path that this screen resolves to. This is used to navigate to this path. The path should start with a / typically. If your screen is /a/b, then you must define your router with a hierarchy that matches this path such as / -> HomeScreen(), children: [ a -> AScreen(), children: b -> THISScreen()

You also need to convert all of your fields in this class into a string that can be used In your route definition you will also have to convert that path back into this screen object

Implementation

@override
String toPath() => withParams("/login", {
      if (redirect != null) "redirect": redirect!,
    });