void click()

in lib/src/stage/game_element.dart [112:155]


  void click(int x, int y, bool alt) {
    assert(!game.gameEnded);
    final ss = game.getSquareState(x, y);

    List<Point<int>>? reveals;

    if (alt) {
      if (ss == SquareState.hidden || ss == SquareState.flagged) {
        _toggleFlag(x, y);
      } else if (ss == SquareState.revealed) {
        if (game.canReveal(x, y)) {
          // get adjacent balloons
          final adjHidden = game.field
              .getAdjacentIndices(x, y)
              .map((i) => game.field.getCoordinate(i))
              .where((t) => game.getSquareState(t.x, t.y) == SquareState.hidden)
              .toList();

          assert(adjHidden.isNotEmpty);

          _startDartAnimation(adjHidden);
          reveals = game.reveal(x, y);
        }
      }
    } else {
      if (ss == SquareState.hidden) {
        _startDartAnimation([Point(x, y)]);
        reveals = game.reveal(x, y);
      }
    }

    if (reveals != null && reveals.isNotEmpty) {
      assert(game.state != GameState.lost);
      if (!alt) {
        // if it was a normal click, the first item should be the clicked item
        final first = reveals[0];
        assert(first.x == x);
        assert(first.y == y);
      }
      _startPopAnimation(Point(x, y), reveals);
    } else if (game.state == GameState.lost) {
      _startPopAnimation(Point(x, y));
    }
  }