EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.43k stars 2.92k forks source link

[flutter] Update deprecating hash method in raw_image_provider.dart #2690

Closed Taormina closed 1 week ago

Taormina commented 1 week ago
Running pod install...                                             747ms
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-000329201AD1001E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00008103-000329201AD1001E, name:My Mac }
../../.pub-cache/hosted/pub.dev/spine_flutter-4.2.32/lib/raw_image_provider.dart:97:12: Error: The method 'hashValues' isn't defined for the class '_RawImageKey'.
 - '_RawImageKey' is from 'package:spine_flutter/raw_image_provider.dart' ('../../.pub-cache/hosted/pub.dev/spine_flutter-4.2.32/lib/raw_image_provider.dart').
Try correcting the name to the name of an existing method, or defining a method named 'hashValues'.
    return hashValues(w, h, format, dataHash.hashCode);
           ^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **

Building macOS application...                                           
Error: Build process failed

In an upcoming version of Flutter that is currently available on the beta and master channels, the old hashValues method has been deprecated. I'm not modifying the Flutter version in this PR, just helping the project get ready for that eventual transition.

https://api.flutter.dev/flutter/dart-ui/hashValues.html more details can be found here but Object.hash is meant to be a drop-in replacement that also works outside of Flutter in pure Dart.

Taormina commented 1 week ago

We ran into this while debugging this issue.

https://github.com/flutter/flutter/issues/159089

badlogic commented 1 week ago

Awesome! I double checked Object.hash(). It's been available since Dart 2.14.0, so safe to use.

badlogic commented 1 week ago

Just published 4.2.33, which contains this fix as well as a bunch of spine-cpp related fixes.