-
-
Notifications
You must be signed in to change notification settings - Fork 286
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
During the profiling of the app I work on, I noticed that hashCode call for larger, deeply nested Freezed models is rather expensive. Upon further inspection, the hashCode is recomputed every time it is accessed.
Describe the solution you'd like
Repeated calls to .hashCode should return the cached value instead of recomputing.
Additional context
A similar request was made in built_value google/built_value.dart#760
Currently Freezed generates
@override
int get hashCode => Object.hash(runtimeType,propertyA,const DeepCollectionEquality().hash(someCollection),...With cached hashCode
int? _cachedHashCode;
@override
int get hashCode => _cachedHashCode ??= Object.hash(runtimeType,propertyA,const DeepCollectionEquality().hash(someCollection),...Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request