adaptive_reroute 0.1.2 copy "adaptive_reroute: ^0.1.2" to clipboard
adaptive_reroute: ^0.1.2 copied to clipboard

Safety-driven route adaptation for winter driving. Evaluates route condition forecasts, decides when rerouting is justified, and generates detour waypoints to bypass hazard zones. Pure Dart, no Flutte [...]

adaptive_reroute #

pub package CI License: BSD-3-Clause

Safety-driven route adaptation for winter driving.

The driver is on a planned route. Conditions ahead change — a hazard appears, weather worsens, the road two segments forward becomes risky. Should you reroute? When? Around what?

adaptive_reroute answers those questions. It consumes a RouteForecast and returns a RerouteDecision — whether to reroute, why, and (if yes) the detour waypoints to feed back to your routing engine.

Pure Dart. No Flutter.

What it gives you #

  • RerouteEvaluator — decides when rerouting is justified given forecast hazards, current position, and configured thresholds.
  • DetourPlanner — generates waypoints that bypass identified hazard zones; respects detour-distance limits and routing-engine constraints.
  • RerouteDecision — typed result with shouldReroute, human-readable reason, and detourWaypoints ready to hand back to a routing engine.
  • AdaptiveRerouteConfig — knobs for hazard thresholds, max detour distance, and minimum-progress-before-reroute logic (avoids rerouting thrashing when the driver has just started).

Install #

dependencies:
  adaptive_reroute: ^0.1.0

You'll also need route_condition_forecast to produce the input forecasts.

Use #

import 'package:adaptive_reroute/adaptive_reroute.dart';
import 'package:route_condition_forecast/route_condition_forecast.dart';

final evaluator = RerouteEvaluator();
final planner = DetourPlanner();

// You produced this from RouteConditionForecaster:
final RouteForecast forecast = ...;

final decision = evaluator.evaluate(
  forecast,
  currentPosition: currentLatLng,
);

if (decision.shouldReroute) {
  print('Rerouting: ${decision.reason}');
  // Hand decision.detourWaypoints to your RoutingEngine to compute
  // the new route around the hazard zone.
  final newRoute = await routingEngine.calculateRoute(
    RouteRequest(
      origin: currentLatLng,
      destination: originalDestination,
      waypoints: decision.detourWaypoints,
    ),
  );
}

When to use this #

When you've already shipped a navigation flow that consumes a forecast and you need a typed, tested decision layer for "do we reroute now, and if so around what?" — instead of re-rolling the threshold + waypoint logic per project.

If you don't yet have a forecast, depend on route_condition_forecast first; it produces the RouteForecast this package consumes.

License #

BSD-3-Clause. See LICENSE.

0
likes
0
points
562
downloads

Publisher

unverified uploader

Weekly Downloads

Safety-driven route adaptation for winter driving. Evaluates route condition forecasts, decides when rerouting is justified, and generates detour waypoints to bypass hazard zones. Pure Dart, no Flutter dependency.

Repository (GitHub)
View/report issues

Topics

#navigation #safety #automotive #winter-driving #routing

License

unknown (license)

Dependencies

driving_weather, equatable, fleet_hazard, latlong2, route_condition_forecast, routing_engine

More

Packages that depend on adaptive_reroute