equals method
bool
equals(
- UpdateableDatabaseItem<
T> ? item, { - List<
String> ignoreFields = const <String>["last_modified"], - bool ignoreSubItems = false,
Implementation
bool equals(
UpdateableDatabaseItem<T>? item, {
List<String> ignoreFields = const <String>["last_modified"],
bool ignoreSubItems = false,
}) {
if (item == null) return false;
if (this is HasDatabaseSubItems && !ignoreSubItems) {
if (!(this as HasDatabaseSubItems)
.equalSubItems(item as HasDatabaseSubItems)) return false;
}
var map = toMap();
var itemMap = item.toMap();
if (map.length != itemMap.length) return false;
for (var key in map.keys) {
if (!itemMap.containsKey(key)) return false;
if (ignoreFields.any((x) => x == key)) continue;
if ((map[key]?.toString() ?? "")
.compareTo(itemMap[key]?.toString() ?? "") !=
0) return false;
}
return true;
}