Answers for "delete in array dart"

0

delete in array dart

// data structure
void delete(int index) {
    int length = arr.length - 1;
    if (index >= 0 && index < length) {
      for (int i = index; i < length; i++) {
        arr[i] = arr[i + 1];
      }
    } else {
      print('This index is not exist');
    }
  }
Posted by: Guest on January-23-2022

Code answers related to "Dart"

Browse Popular Code Answers by Language