finishGuidance method

  1. @override
Future<void> finishGuidance(
  1. double? usagePercentage
)
override

Implementation

@override
Future<void> finishGuidance(double? usagePercentage) {
  // Both SDKs already clamp to 0..100 and derive the percentage themselves for a non-finite value, so this is not papering over a divergence. It is wrapper-level defence: the value on the wire is already normalised, and one place answers for what the Dart API promises rather than two native implementations having to be kept in step with it.
  final double? percentage =
      (usagePercentage == null || !usagePercentage.isFinite)
          ? null
          : usagePercentage.clamp(0.0, 100.0).toDouble();
  return directionsRendererMethodChannel
      .invokeMethod('DRE_finishGuidance', {"usagePercentage": percentage});
}