felangel/equatable

[2.0.1]Exception when the key of Map is not subtype of type Comparable.

elseyu opened this issue · 3 comments

Describe the bug
Exception when the key of Map is not subtype of type Comparable.

To Reproduce

  1. Define a Map<Type not comparable, V>
  2. Define your class which extends Equable
class Key extends Equable {
  Map<Type not comparable, V> cacheMap,
  @override
  List<Object?> get props => [cacheMap];
}
  1. Exception on:
    [flutter_exception][:0]type 'Key' is not a subtype of type 'Comparable'
    [flutter_exception][:0]#0 _dynamicCompare (dart:collection/splay_tree.dart:261:65)
    #1 _SplayTree._splay (dart:collection/splay_tree.dart:93:21)
    #2 SplayTreeMap.[]= (dart:collection/splay_tree.dart:391:16)
    #3 SplayTreeMap.addAll. (dart:collection/splay_tree.dart:422:11)
    #4 LinkedLruHashMap.forEach (package:kk_shared/common/util/lru_map.dart:87:8)
    #5 SplayTreeMap.addAll (dart:collection/splay_tree.dart:421:11)
    #6 new SplayTreeMap.of (dart:collection/splay_tree.dart:329:48)
    #7 _combine (package:equatable/src/equatable_utils.dart:44:5)

Version
2.0.1

@elseyu thanks for reporting this and sorry for the inconvenience! It should be fixed by #120 and published within the next few mins in v2.0.2

The fix has been published in v2.0.2. Please let me know if that helps and again I apologize for the inconvenience!

@felangel Thanks for your quick fixing, it works for me.