Files
GitJournal/lib/core/note_data.dart
2020-01-01 19:50:31 +01:00

35 lines
870 B
Dart

import 'dart:collection';
class NoteData {
String body = "";
LinkedHashMap<String, dynamic> props = LinkedHashMap<String, dynamic>();
NoteData([this.body, this.props]) {
body = body ?? "";
// ignore: prefer_collection_literals
props = props ?? LinkedHashMap<String, dynamic>();
}
@override
int get hashCode => body.hashCode ^ props.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is NoteData &&
runtimeType == other.runtimeType &&
body == other.body &&
_equalMaps(props, other.props);
static bool _equalMaps(Map a, Map b) {
if (a.length != b.length) return false;
return a.keys
.every((dynamic key) => b.containsKey(key) && a[key] == b[key]);
}
@override
String toString() {
return 'NoteData{body: $body, props: $props}';
}
}