delete method

  1. @override
void delete(
  1. String id,
  2. NmTelecomL10n l10n
)
override

Delete.

Implementation

@override
void delete(String id, NmTelecomL10n l10n) {
  if (byId(id) == null) {
    throw NmPlanRepositoryException(l10n.planErrNotFound(id));
  }
  if (id == 'default') {
    throw NmPlanRepositoryException(l10n.planErrDefaultProtected);
  }
  final usageCount = liveSimPlanIds().where((planId) => planId == id).length;
  if (usageCount > 0) {
    throw NmPlanRepositoryException(l10n.planErrInUseShort(id, usageCount));
  }
  _records = _records.where((item) => item.id != id).toList();
}