hunnichat/lib/utils/event_checkbox_extension.dart
mowetentertainment1 8ee77e3548
Some checks failed
Main Deploy Workflow / deploy_web (push) Has been cancelled
Main Deploy Workflow / deploy_playstore_internal (push) Has been cancelled
12/6/2025
2025-12-06 12:46:34 -05:00

28 lines
687 B
Dart

import 'package:matrix/matrix.dart';
extension EventCheckboxRoomExtension on Room {
static const String relationshipType = 'im.fluffychat.checkboxes';
Future<String?> checkCheckbox(
String eventId,
int checkboxId, {
String? txid,
}) =>
sendEvent(
{
'm.relates_to': {
'rel_type': relationshipType,
'event_id': eventId,
'checkbox_id': checkboxId,
},
},
type: EventTypes.Reaction,
txid: txid,
);
}
extension EventCheckboxExtension on Event {
int? get checkedCheckboxId => content
.tryGetMap<String, Object?>('m.relates_to')
?.tryGet<int>('checkbox_id');
}