diff --git a/lib/equatable.dart b/lib/equatable.dart index 4f6b3534..2a8bee47 100644 --- a/lib/equatable.dart +++ b/lib/equatable.dart @@ -5,3 +5,4 @@ library equatable; export './src/equatable.dart'; export './src/equatable_config.dart'; export './src/equatable_mixin.dart'; +export './src/equatable_utils.dart'; diff --git a/lib/src/equatable_mixin.dart b/lib/src/equatable_mixin.dart index b69db159..b531ffae 100644 --- a/lib/src/equatable_mixin.dart +++ b/lib/src/equatable_mixin.dart @@ -21,10 +21,14 @@ mixin EquatableMixin { bool operator ==(Object other) { return identical(this, other) || other is EquatableMixin && - runtimeType == other.runtimeType && + (!checkRuntimeTypeOnIdentical || + runtimeType == other.runtimeType) && iterableEquals(props, other.props); } + /// Whether to check runtimeType in order to consider two objects equal. + bool get checkRuntimeTypeOnIdentical => true; + @override int get hashCode => runtimeType.hashCode ^ mapPropsToHashCode(props);