nextId property

int get nextId

Implementation

int get nextId {
  if (isEmpty) {
    return 1;
  } else {
    final that = toList()
      ..sort((a, b) => a.id.compareTo(b.id))
      ..toList();
    if (that.last.id < 0) {
      return 1;
    } else {
      return that.last.id + 1;
    }
  }
}