anchor.diff:  /// Throws an [Exception] if an invalid instruction is found.
   int partTwo(String instructions) {
     var floor = 0;
  -  for (var i = 0; i < instructions.length - 1; i++) {
  +
  +  var i = 0;
  +  while (i < instructions.length && floor != -1) {
       switch (instructions[i]) {
         case '(':
           floor++;
  
positive.code:       case ')':
          floor--;
          break;
        default:
          throw 'Invalid instruction at index $i: \'${instructions[i]}\'.';
      }
    }
    return floor;
  }
  
  
negative.code: import 'dart:io';
  import 'read_input.dart';
  
  /// Shows the solution for part one and two of the problem.
  void main() {
    var input = readInput('day1_input');
    try {
      print('Part one: ${partOne(input)}');
      print('Part two: ${partTwo(input) ?? 'Santa never entered the basement.'}');
    } catch (e) {
      print('Error: $e');
    }
  