Added docs and dependency
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:cabo_counter/data/game_session.dart';
|
||||
import 'package:cabo_counter/services/local_storage_service.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class GameManager extends ChangeNotifier {
|
||||
@@ -21,8 +22,12 @@ class GameManager extends ChangeNotifier {
|
||||
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) {
|
||||
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.
|
||||
|
||||
@@ -2,7 +2,7 @@ name: cabo_counter
|
||||
description: "Mobile app for the card game Cabo"
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.5.0+568
|
||||
version: 0.5.1+568
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.4
|
||||
@@ -29,6 +29,7 @@ dependencies:
|
||||
uuid: ^4.5.1
|
||||
rate_my_app: ^2.3.2
|
||||
reorderables: ^0.4.2
|
||||
collection: ^1.18.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user