hash static method
- @Since.new("2.14")
- Object?object1,
- Object?object2, [
- Object?object3 =sentinelValue,
- Object?object4 =sentinelValue,
- Object?object5 =sentinelValue,
- Object?object6 =sentinelValue,
- Object?object7 =sentinelValue,
- Object?object8 =sentinelValue,
- Object?object9 =sentinelValue,
- Object?object10 =sentinelValue,
- Object?object11 =sentinelValue,
- Object?object12 =sentinelValue,
- Object?object13 =sentinelValue,
- Object?object14 =sentinelValue,
- Object?object15 =sentinelValue,
- Object?object16 =sentinelValue,
- Object?object17 =sentinelValue,
- Object?object18 =sentinelValue,
- Object?object19 =sentinelValue,
- Object?object20 =sentinelValue,
Creates a combined hash code for a number of objects.
The hash code is computed for all arguments that are actuallysupplied, even if they arenull, by numerically combining theObject.hashCode of each argument.
Example:
class SomeObject { final Object a, b, c; SomeObject(this.a, this.b, this.c); bool operator ==(Object other) => other is SomeObject && a == other.a && b == other.b && c == other.c; int get hashCode => Object.hash(a, b, c);}The computed value will be consistent when the function is calledwith the same arguments multiple timesduring the execution of a single program.
The hash value generated by this function isnot guaranteed to be stableover different runs of the same program,or between code run in different isolates of the same program.The exact algorithm used may differ between different platforms,or between different versions of the platform libraries,and it may depend on values that change on each program execution.
ThehashAll function gives the same result as this function whencalled with a collection containing the actual argumentsto this function in the same order.
Implementation
@Since("2.14")static int hash( Object? object1, Object? object2, [ Object? object3 = sentinelValue, Object? object4 = sentinelValue, Object? object5 = sentinelValue, Object? object6 = sentinelValue, Object? object7 = sentinelValue, Object? object8 = sentinelValue, Object? object9 = sentinelValue, Object? object10 = sentinelValue, Object? object11 = sentinelValue, Object? object12 = sentinelValue, Object? object13 = sentinelValue, Object? object14 = sentinelValue, Object? object15 = sentinelValue, Object? object16 = sentinelValue, Object? object17 = sentinelValue, Object? object18 = sentinelValue, Object? object19 = sentinelValue, Object? object20 = sentinelValue,]) { if (sentinelValue == object3) { return SystemHash.hash2(object1.hashCode, object2.hashCode, _hashSeed); } if (sentinelValue == object4) { return SystemHash.hash3( object1.hashCode, object2.hashCode, object3.hashCode, _hashSeed, ); } if (sentinelValue == object5) { return SystemHash.hash4( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, _hashSeed, ); } if (sentinelValue == object6) { return SystemHash.hash5( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, _hashSeed, ); } if (sentinelValue == object7) { return SystemHash.hash6( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, _hashSeed, ); } if (sentinelValue == object8) { return SystemHash.hash7( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, _hashSeed, ); } if (sentinelValue == object9) { return SystemHash.hash8( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, _hashSeed, ); } if (sentinelValue == object10) { return SystemHash.hash9( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, _hashSeed, ); } if (sentinelValue == object11) { return SystemHash.hash10( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, _hashSeed, ); } if (sentinelValue == object12) { return SystemHash.hash11( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, _hashSeed, ); } if (sentinelValue == object13) { return SystemHash.hash12( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, _hashSeed, ); } if (sentinelValue == object14) { return SystemHash.hash13( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, _hashSeed, ); } if (sentinelValue == object15) { return SystemHash.hash14( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, object14.hashCode, _hashSeed, ); } if (sentinelValue == object16) { return SystemHash.hash15( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, object14.hashCode, object15.hashCode, _hashSeed, ); } if (sentinelValue == object17) { return SystemHash.hash16( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, object14.hashCode, object15.hashCode, object16.hashCode, _hashSeed, ); } if (sentinelValue == object18) { return SystemHash.hash17( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, object14.hashCode, object15.hashCode, object16.hashCode, object17.hashCode, _hashSeed, ); } if (sentinelValue == object19) { return SystemHash.hash18( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, object14.hashCode, object15.hashCode, object16.hashCode, object17.hashCode, object18.hashCode, _hashSeed, ); } if (sentinelValue == object20) { return SystemHash.hash19( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, object14.hashCode, object15.hashCode, object16.hashCode, object17.hashCode, object18.hashCode, object19.hashCode, _hashSeed, ); } return SystemHash.hash20( object1.hashCode, object2.hashCode, object3.hashCode, object4.hashCode, object5.hashCode, object6.hashCode, object7.hashCode, object8.hashCode, object9.hashCode, object10.hashCode, object11.hashCode, object12.hashCode, object13.hashCode, object14.hashCode, object15.hashCode, object16.hashCode, object17.hashCode, object18.hashCode, object19.hashCode, object20.hashCode, _hashSeed, );}