Added docs and dependency

This commit is contained in:
2025-07-20 20:36:04 +02:00
parent cadaf4ce99
commit fd79698b30
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import 'package:cabo_counter/data/game_session.dart'; import 'package:cabo_counter/data/game_session.dart';
import 'package:cabo_counter/services/local_storage_service.dart'; import 'package:cabo_counter/services/local_storage_service.dart';
import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
class GameManager extends ChangeNotifier { class GameManager extends ChangeNotifier {
@@ -21,8 +22,12 @@ class GameManager extends ChangeNotifier {
return gameList.indexOf(session); return gameList.indexOf(session);
} }
/// Retrieves a game session by its id.
/// Takes a String [id] as input. It searches the `gameList` for a session
/// with a matching id and returns it if found.
/// If no session is found, it returns null.
GameSession? getGameSessionById(String id) { GameSession? getGameSessionById(String id) {
return gameList.firstWhere((session) => session.id.toString() == id); return gameList.firstWhereOrNull((session) => session.id.toString() == id);
} }
/// Removes a game session from the list and sorts it by creation date. /// Removes a game session from the list and sorts it by creation date.

View File

@@ -2,7 +2,7 @@ name: cabo_counter
description: "Mobile app for the card game Cabo" description: "Mobile app for the card game Cabo"
publish_to: 'none' publish_to: 'none'
version: 0.5.0+568 version: 0.5.1+568
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4
@@ -29,6 +29,7 @@ dependencies:
uuid: ^4.5.1 uuid: ^4.5.1
rate_my_app: ^2.3.2 rate_my_app: ^2.3.2
reorderables: ^0.4.2 reorderables: ^0.4.2
collection: ^1.18.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: