bindRouteInformationProvider method
Binds a Flutter RouteInformationProvider without depending on a particular router package. This also covers go_router's public provider.
The returned callback releases this caller's binding. Calling it more than once is harmless.
Implementation
VoidCallback bindRouteInformationProvider(RouteInformationProvider provider) {
if (_isDisposed) {
return () {};
}
for (final binding in _routeInformationBindings) {
if (identical(binding.provider, provider)) {
binding.retain();
return _routeInformationReleaseCallback(binding);
}
}
final binding = _FlutterCockpitRouteInformationBinding(
provider: provider,
onChanged: _setRouteInformation,
);
_routeInformationBindings.add(binding);
binding.retain();
return _routeInformationReleaseCallback(binding);
}