Flutter Chess is a Flutter application that allows users to create or join chess rooms and play chess in real-time. The app uses Firebase Realtime Database as the backend to manage users, rooms, and game states. The project leverages the BLoC pattern for state management and real-time updates.
- User Registration
- Create and Join Chess Rooms
- Real-time Chess Gameplay
- Pawn Promotion and Castling
- End Game Detection (Checkmate and Draw)
- Room and Game State Management with Firebase and BLoC
- Responsive UI
| User Registration | Lounge | Room As Guest Can Join |
|---|---|---|
![]() |
![]() |
![]() |
| Room As Host Waiting | Room As Host Can Start | Game Started |
|---|---|---|
![]() |
![]() |
![]() |
- Flutter
- Firebase Realtime Database
- Bloc
- Simple Chess Board (Dart Package)
- Chess Engine (Dart Package)
lib
├── blocs
│ ├── lounge_cubit
│ │ └── lounge_cubit.dart
│ ├── room_cubit
│ │ ├── room_cubit.dart
│ │ └── room_state.dart
│ └── user_cubit
│ ├── user_cubit.dart
│ └── user_state.dart
├── models
│ ├── game_model.dart
│ ├── invite_model.dart
│ ├── room_model.dart
│ └── user_model.dart
├── screens
│ ├── create_game_screen.dart
│ ├── game_screen.dart
│ ├── invites_screen.dart
│ ├── lounge_screen.dart
│ ├── main_screen.dart
│ ├── registration_screen.dart
│ └── room_detail_screen.dart
├── services
│ └── firebase_RTDB_service.dart
├── app.dart
├── firebase_options.dart
└── main.dart
Below getting started instructions assumes you are using macOS,
- Xcode (iOS)
- Latest iOS SDK for running iOS Simulator on macOS
- Flutter Version Manager
- Your own Firebase project with Realtime Database created
Follow these steps to run the Flutter Chess app:
-
Clone the repository:
git clone git@github.com:cenk-idris/flutter_chess.git
-
Navigate to the project directory:
cd flutter_chess -
Add Firebase to the project. Follow the instructions here to set up Firebase for iOS.
-
Use the correct Flutter version:
fvm use
-
Clean the project:
fvm flutter clean
-
Get the project dependencies:
fvm flutter pub get
-
Launch the iOS simulator:
fvm flutter emulators --launch apple_ios_simulator
-
Run the app in debug mode:
fvm flutter run --debug
-
You will be prompted to choose the target device/platform. Pick the Simulator's iOS instance you just launched.
-
Cross your fingers :)
- Users can register with a username.
- After registration, users can create a new chess room or join to available rooms listed in the lounge.
- The user who creates the room becomes the host and the one joins becomes guest.
- The guest user will see the host’s details and wait for the host to start the game.
- Once the host starts the game, both players can make moves in real-time.
- The game board updates for both players as they make moves.
- Pawn promotion is handled, and players can promote their pawns.
- Castling is available, allowing players to perform both kingside and queenside castling.
- The game detects checkmate and draw conditions, and the game ends accordingly.
This project is licensed under the MIT License. See the LICENSE file for details.





