updateAccount method

Future<void> updateAccount(
  1. AccountModel acc
)

Update existing account with new params values

Implementation

Future<void> updateAccount(AccountModel acc) async {
   try {
    int index = _accounts.indexWhere((a) => a.myAccId==acc.myAccId);
    if(index == -1) return Future.error("Account with specified id not found");

    await SiprixVoipSdk().updateAccount(acc);

    _accounts[index] = acc;

    notifyListeners();
    _raiseSaveChanges();
    _logs?.print('Updated account accId:${acc.myAccId}');

  } on PlatformException catch (err) {
    _logs?.print('Can\'t update account: ${err.code} ${err.message}');
    return Future.error((err.message==null) ? err.code : err.message!);
  }
}