Repository: flutter
Issue: HSVColor.lerp and HSLColor.lerp don't interpolate hue via 0
Labels: framework,has reproducible steps,P2,team-framework,triaged-framework,found in release: 3.13,found in release: 3.17

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

Use HSVColor.lerp or HSLColor.lerp to interpolate between a color with a hue close to 360 (for example, HSVColor.fromAHSV(1, 300, 1, 1)) and a color with a hue close to 0 (for example, HSVColor.fromAHSV(1, 60, 1, 1)) so that the difference is greater than 180.

### Expected results

The resulting hue is interpolated using the shortest path: 300 -> 360(0) -> 60.

### Actual results

The resulting hue is interpolated using the longest path: 300 -> 180 -> 60.

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: SizedBox(
            width: 100,
            height: 100,
            child: ColorAnimation(),
          ),
        ),
      ),
    );
  }
}

class ColorAnimation extends StatefulWidget {
  const ColorAnimation({Key? key}) : super(key: key);

  @override
  State<ColorAnimation> createState() => _ColorAnimationState();
}

class _ColorAnimationState extends State<ColorAnimation>
    with SingleTickerProviderStateMixin {
  late final controller = AnimationController(
    duration: const Duration(seconds: 24),
    vsync: this,
  );
  late final animation = HSVColorTween(
    begin: const HSVColor.fromAHSV(1, 300, 1, 1),
    end: const HSVColor.fromAHSV(1, 60, 1, 1),
  ).animate(controller);

  @override
  void initState() {
    super.initState();
    controller.repeat(reverse: true);
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ListenableBuilder(
      listenable: animation,
      builder: (context, child) {
        return ColoredBox(
          color: animation.value!.toColor(),
          child: Center(
            child: Text(animation.value!.hue.round().toString()),
          ),
        );
      },
    );
  }
}

class HSVColorTween extends Tween<HSVColor?> {
  HSVColorTween({super.begin, super.end});

  @override
  HSVColor? lerp(double t) => HSVColor.lerp(begin, end, t);
}
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

![image](https://github.com/flutter/flutter/assets/5618861/8c9b1b65-841b-49df-b156-75573b7e34a2)


</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-arm64, locale en-UA)
    • Flutter version 3.13.9 on channel stable at /Users/andrew/Applications/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (2 weeks ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/andrew/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Users/andrew/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10811636/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/andrew/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10811636/Android
      Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/andrew/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.11005911/Android
      Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.83.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.74.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.1 23B74 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 119.0.6045.123

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>