deleteAccountById method

  1. @override
Future<AccountV1?> deleteAccountById(
  1. String? correlationId,
  2. String id
)
override

Deleted an account by it's unique id.

  • correlation_id (optional) transaction id to trace execution through call chain.
  • id an id of the account to be deleted Return Future that receives deleted account Throws error.

Implementation

@override
Future<AccountV1?> deleteAccountById(String? correlationId, String id) async {
  var index = _accounts.indexWhere((el) => el.id == id);
  var item = _accounts[index];

  if (index < 0) {
    return null;
  }

  item.deleted = true;
  //this._accounts.sublist(index, 1);

  return item;
}