Add RouteLogger to observe route information
Introduced a RouteLogger class implementing WidgetsBindingObserver to log incoming route information. Replaced the previous onRouteInformationUpdated handler with the observer pattern for improved route logging.
This commit is contained in:
parent
3389845651
commit
2b517bed69
|
|
@ -67,13 +67,20 @@ String assetsDir = "";
|
||||||
String appDir = "";
|
String appDir = "";
|
||||||
Map<String, String> environmentVariables = {};
|
Map<String, String> environmentVariables = {};
|
||||||
|
|
||||||
|
class RouteLogger with WidgetsBindingObserver {
|
||||||
|
@override
|
||||||
|
Future<bool> didPushRouteInformation(
|
||||||
|
RouteInformation routeInformation,
|
||||||
|
) async {
|
||||||
|
debugPrint('📩 routeInformation: ${routeInformation.uri}');
|
||||||
|
return false; // return true only if YOU handled it and don't want default handling
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void main(List<String> args) async {
|
void main(List<String> args) async {
|
||||||
|
|
||||||
PlatformDispatcher.instance.onRouteInformationUpdated =
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
(RouteInformation routeInformation) {
|
WidgetsBinding.instance.addObserver(RouteLogger());
|
||||||
// This logs every incoming route/deeplink from the platform
|
|
||||||
print('📩 routeInformation: ${routeInformation.uri}');
|
|
||||||
};
|
|
||||||
|
|
||||||
_args = List<String>.from(args);
|
_args = List<String>.from(args);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue