getHashCode method

Future<int> getHashCode(
  1. InstanceRef instance, {
  2. required Disposable? isAlive,
})

Implementation

Future<int> getHashCode(
  InstanceRef instance, {
  required Disposable? isAlive,
}) async {
  // identityHashCode will be -1 if the Flutter SDK is not recent enough
  if (instance.identityHashCode != -1 && instance.identityHashCode != null) {
    return instance.identityHashCode!;
  }

  final hash = await evalInstance(
    'instance.hashCode',
    isAlive: isAlive,
    scope: {'instance': instance.id!},
  );

  return int.parse(hash.valueAsString!);
}