Hello,
When appointment objects are identical, only one is displayed.
You will find attached an example of code (with syncfusion_flutter_calendar: ^19.3.55) and a preview with and without the hashcode and == methods defined.
Have a nice day
@override
int get hashCode {
return Object.hashAll(
<Object>[
eventName,
from,
to,id
],
);
}
@override
bool operator ==(Object other) {
return other is Meeting &&
other.eventName == eventName &&
other.from == from&&
other.to == to&&other.id==id;
} |
Hello Indumathi,
Thank you for the quick answer and the explanation.
I intentionally omitted the id property, in order to check the content and not the identity.
I don't know what to think about the implementation regarding the comparison.
But I think I will map my Domain objects to a specific object for Calendar that does the comparison on id.
Kind regards,
Ilyas
List<Meeting> _getDataSource() {
final DateTime begin = DateTime(2022, 01, 20, 12);
final DateTime end = begin.add(const Duration(hours: 1));
final List<Meeting> meetings = <Meeting>[
Meeting(
'MO000004',
'Conference',
begin,
end,
),
Meeting(
'MO000080',
'Conference',
begin,
end,
),
Meeting(
'MO000084',
'Conference',
begin,
end,
),
Meeting(
'MO000075',
'Conference',
begin,
end,
),
Meeting(
'MO000081',
'Conference',
begin,
end,
),
];
for (int i = 0; i < meetings.length - 1; i++) {
print(meetings[i] == meetings[i + 1]);
}
return meetings;
} |