updateGroup method
takes AtGroup as an input and updates the group on success return AtGroup otherwise null
Implementation
@override
Future<AtGroup?> updateGroup(AtGroup atGroup) async {
if (atGroup.groupName == null) {
throw Exception('Group name is null or empty String');
}
var groupId = atGroup.groupId;
var group = await getGroup(groupId);
if (group == null) {
throw GroupNotExistsException(
'There is no Group exisits with Id $groupId');
}
var atKey = _formKey(KeyType.group, key: atGroup.groupId!);
//update atGroup
atGroup.updatedOn = DateTime.now();
var json = atGroup.toJson();
var value = jsonEncode(json);
var success = await atClient!.put(atKey, value);
var result = success ? atGroup : null;
return result;
}