flutter_dubov_system 0.0.1 copy "flutter_dubov_system: ^0.0.1" to clipboard
flutter_dubov_system: ^0.0.1 copied to clipboard

Platformweb

High-performance Flutter wrapper for the FIDE-approved CPPDubovSystem engine. Enables official chess tournament pairings on the web using C++ compiled to WebAssembly.

Flutter Dubov System #

pub package License: MIT

A high-performance Flutter plugin providing a Dart wrapper for the CPPDubovSystem engine. This package allows developers to easily integrate FIDE-approved Swiss system tournament pairing logic into Flutter applications, specifically targeting the web via WebAssembly.

Key Features #

  • FIDE-Approved Engine: Built on top of the robust CPPDubovSystem core, which is officially recognized by the International Chess Federation (FIDE) for official tournament matchmaking.
  • WebAssembly (WASM) Implementation: Utilizes a compiled C++ version of the pairing logic to ensure near-native calculation speeds and absolute precision directly within the browser.
  • Federated Architecture: Designed for scalability, separating the public API from the platform-specific implementation to allow for future desktop/mobile expansion.
  • Complete Pairing Logic: Fully supports chess player management, Elo rating tracking, color allocation (White/Black), and the automated generation of official Dubov Swiss pairings.

Getting Started #

Web Support & Initialization #

The current implementation leverages WASM to run the C++ chess engine. You must initialize the engine before performing any tournament operations.

import 'package:flutter/material.dart';
import 'package:flutter_dubov_system/flutter_dubov_system.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await DubovSystem.initialize();
  runApp(const MyApp());
}

Basic Usage #

⚠️ Important Memory Management Note: Because this package bridges Dart with a C++ WASM instance, Dart's garbage collector cannot automatically clean up the underlying C++ objects. You must manually call .delete() on your players and tournaments once they are no longer needed to prevent memory leaks.

final tournament = DubovSystem.createTournament(3);

final p1 = DubovSystem.createPlayer('Khalil', 2850, 1, 0);
final p2 = DubovSystem.createPlayer('Amir', 2790, 2, 0);

tournament.addPlayer(p1);
tournament.addPlayer(p2);

tournament.setRound1Color(true);

final pairings = tournament.generatePairings(1);

for (var match in pairings) {
  if (match.isBye) {
    print('${match.white.name} receives a BYE');
  } else {
    print('${match.white.name} (White) vs ${match.black.name} (Black)');
  }
}

p1.delete();
p2.delete();
tournament.delete();

Technical Details #

This package acts as a highly efficient bridge between the Flutter framework and the CPPDubovSystem C++ library. By utilizing dart:js_interop, it invokes the pairing routines compiled into the dubov.wasm binary. This architecture ensures that the complex algorithmic logic remains identical to the FIDE-approved source code while executing rapidly on the web client.

0
likes
160
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

High-performance Flutter wrapper for the FIDE-approved CPPDubovSystem engine. Enables official chess tournament pairings on the web using C++ compiled to WebAssembly.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_dubov_system_platform_interface, flutter_dubov_system_web

More

Packages that depend on flutter_dubov_system

Packages that implement flutter_dubov_system