chess_interface_dart 1.0.8
chess_interface_dart: ^1.0.8 copied to clipboard
chess_interface_dart is a pure dart package and doesn't include any flutter component. This package is useful for back-end utilities. Contains detailed examples for all APIs.
chess_interface_dart #
Complete chess functionalities including FEN initialization, en-passant, checkmate and draw rules. This is a pure dart package for backend and doesn't include flutter components for front-end. Visit chess_interface for complete front-end package
Features #
- β Built-in move validation for all standard piece types
- π Supports en passant, castling, and pawn promotion logic
- π Interface-driven board interaction for flexible state management
- β±οΈ Countdown stream for both players.
Getting Started #
Add the package to your pubspec.yaml:
dependencies:
chess_interface_dart:
git:
url: https://github.com/mryadavdilip/chess_interface_dart.git
OR
dependencies:
chess_interface_dart: ^1.0.8
Then import these:
import 'package:chess_board_widget/logical_interface/interface.dart';
Example #
ChessBoardInterface game = ChessBoardInterface(
// optional
fen: 'qkN/p7/8/8/8...',
// optional
timeLimit: Duration(minutes: 10),
);
Move Validation #
Use MoveValidator.isValidMove() to validate legal chess moves:
bool isValid = MoveValidator.isValidMove(ChessBoardInterface game, Position from, Position to);
It supports:
- All standard chess moves
- Pawn special rules
- Castling logic (including history tracking)
- En passant and double pawn pushes
Arbiter #
Arbiter to handle events like game over, time out and pawn promotion:
And more.. #
File Structure #
arbiter.dartβ Game over, timeOut, and promotion handlerinterface.dartβ Board interaction interfacemove_validator.dartβ Move legality checkerpiece.dartβ Piece model and asset loader
Contributing #
Contributions are welcome! Please open issues and pull requests to help improve this Package.
License #
MIT License. See LICENSE for details.
