Dart pencarian linier

void linearSearch(int key) {
    bool isExist = false;
    for (var i = 0; i < list.length; i++) {
      if (list[i] == key) {
        print("The item ${list[i]} is exist and it's index is $i");
        isExist = true;
        return;
      }
    }
    if (!isExist) {
      print("Not found");
    }
  }
Old-fashioned Okapi