BasicRouter class Null safety

Very minimalistic hash based router. Just define your routes like this:

routeBuilder: (route) {
    switch (route) {
      case '/':
         return TodoListPage();
      default:
        return NotFoundPage();
   }
},
Inheritance

Constructors

BasicRouter({required Widget routeBuilder(String), String? initialRoute})

Properties

currentRoute String
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
mounted bool
Checks if this widget instance is still mounted to the DOM.
read-only, inherited
parent Widget?
read-only, inherited
routeBuilder Widget Function(String)
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addPostSetStateCallback(Function callback) → void
Perform some action after setState has been called.
inherited
appendTo(Widget parent) Element
Use this method inside of the build method of the parent widget to append this widget to it. This creates a widget tree and makes it possible to use the findParent() and setState() method.
inherited
build() Element
Method which needs to be defined by the developer to describe the UI using HTML Elements. It is not recommended to use this method to append your widget in the build method of another widget! Use appendTo for this!
override
findParent<T>() → T
Looks up the widget tree until it finds a parent of this type or otherwise throws an exception. Make sure that this widget has been appended by the appendTo() method first.
inherited
initState() → void
Override this method to initialize the state of this widget. The parent value is already set when this method is called.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
push(String route) → void
setState(void fun()) → void
Similar to the Flutter equivalent this changes the state of this widget and rebuilds the UI and all underlying widgets. Make sure that this widget has been appended by the appendTo() method first.
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited