objId static method

  1. @protected
int objId(
  1. Object object
)

Creates an integer id from the specified object. If the object is already an int, it is returned as is. Otherwise, the object is converted to a string with spaces removed, then the hashCode is calculated and returned.

Implementation

@protected
@pragma('vm:prefer-inline')
static int objId(Object object) =>
    object is int ? object : object.toString().replaceAll(' ', '').hashCode;