Before this change any system push intents e.g. with new deep links would be lost on Android. This was happening when app was running in the background and new deep link was received. Now if there's any information about the deep link route, it will be passed to WidgetsBinding so that all subscribers would be able to handle it (RouterDelegate, MaterialApp, custom implementors of WidgetsBinding).
Sample implementation of custom handler:
class CustomHandler with WidgetsBindingObserver {
CustomHandler(WidgetsBinding widgetsBinding)
: _widgetsBinding = widgetsBinding,
assert(widgetsBinding != null) {
_widgetsBinding.addObserver(this);
}
final WidgetsBinding _widgetsBinding;
/// Must be called when the `MaterialApp` is initialized
/// in order to fetch the initial route.
///
/// The initial route cannot be fetched before the
/// `MaterialApp` is built for the first time.
void initialize() {
final route = _widgetsBinding.window.defaultRouteName;
if (route != null) {
// handle
}
}
@override
Future<bool> didPushRouteInformation(
RouteInformation routeInformation) async {
// handle
return true;
}
@override
Future<bool> didPushRoute(String route) async {
// handle
return true;
}
/// Disposes subscribing to WidgetsBinding events
void dispose() {
_widgetsBinding.removeObserver(this);
}
}
Type of Change
[ ] โจ New feature (non-breaking change which adds functionality)
[x] ๐ ๏ธ Bug fix (non-breaking change which fixes an issue)
[ ] โ Breaking change (fix or feature that would cause existing functionality to change)
Status
READY
Breaking Changes
NO
Description
Before this change any system push intents e.g. with new deep links would be lost on Android. This was happening when app was running in the background and new deep link was received. Now if there's any information about the deep link route, it will be passed to WidgetsBinding so that all subscribers would be able to handle it (RouterDelegate, MaterialApp, custom implementors of WidgetsBinding).
Sample implementation of custom handler:
Type of Change