canNavigate abstract method
Called by the router upon navigation.
The client should return a future that completes with a boolean indicating whether the router is allowed to navigate.
class MyComponent implements CanNavigate {
bool get _hasFormBeenSaved => ...;
@override
Future<bool> canNavigate() async => _hasFormBeenSaved;
}
This lifecycle occurs before any others during navigation.
Implementation
Future<bool> canNavigate();