This repository contains a modern, mobile-friendly clone of the classic Minesweeper puzzle game, built entirely with Flutter. It challenges players to clear a rectangular grid containing hidden "mines" without detonating any of them, using mathematical clues provided by the safe cells.
Building this game in Flutter is an excellent demonstration of handling complex grid states, efficient UI rendering, and reactive state management in a mobile environment.
- Dynamic Grid: A fully responsive grid that adapts to different screen sizes.
- Reactive Gameplay: Instant state updates when revealing cells or placing flags.
- Recursive Revealing (Flood Fill): Automatically clears adjacent empty cells when a completely safe cell is tapped, providing a smooth gameplay experience.
- Win/Loss Logic: Accurately tracks the game state, triggering game over or victory dialogs.
- Flagging System: Long-press (or toggle) mechanic to mark suspected mine locations.
- Framework: Flutter
- Language: Dart
- Core Concepts:
GridView.builderfor efficient layout mapping, recursive algorithms for the flood-fill effect, and robust state management.
If you want to run this game on your local machine:
- Clone the repository:
git clone [https://github.com/OmerFarukAY/flutter-minesweeper.git](https://github.com/OmerFarukAY/flutter-minesweeper.git) cd flutter-minesweeper - Install dependencies:
flutter pub get
- Run the app:
flutter run
(Make sure you have an emulator running or a physical device connected).
🕹️ How to Play Tap a cell to reveal it. If it's a mine, the game is over!
If the cell is safe, it displays a number indicating how many mines are hiding in the adjacent 8 squares.
Use logic to deduce where the mines are. Long-press to place a flag on suspected mines.
You win when all non-mine cells are successfully revealed.
Author: Ömer Faruk AY