Skip to content

Commit 0a30832

Browse files
committed
docs: clarify item limit check methods
- Clarify single item check - Clarify full state check
1 parent 331482f commit 0a30832

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/src/services/user_preference_limit_service.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ abstract class UserPreferenceLimitService {
77
/// {@macro user_preference_limit_service}
88
const UserPreferenceLimitService();
99

10-
/// Checks if the user is allowed to add an item of the given type,
10+
/// Checks if the user is allowed to add a *single* item of the given type,
1111
/// considering their current count of that item type and their role.
1212
///
13+
/// This method is typically used when a user performs an action that adds
14+
/// one item, such as saving a single headline or following a single source.
15+
///
1316
/// - [user]: The authenticated user.
1417
/// - [itemType]: The type of item being added (e.g., 'country', 'source',
1518
/// 'category', 'headline').
@@ -19,8 +22,13 @@ abstract class UserPreferenceLimitService {
1922
/// limit for their role.
2023
Future<void> checkAddItem(User user, String itemType, int currentCount);
2124

22-
/// Checks if the proposed [updatedPreferences] for the user exceed
23-
/// the limits based on their role.
25+
/// Checks if the proposed *entire state* of the user's preferences,
26+
/// represented by [updatedPreferences], exceeds the limits based on their role.
27+
///
28+
/// This method is typically used when the full [UserContentPreferences] object
29+
/// is being updated, such as when a user saves changes from a preferences screen.
30+
/// It validates the total counts across all relevant lists (followed countries,
31+
/// sources, categories, and saved headlines).
2432
///
2533
/// - [user]: The authenticated user.
2634
/// - [updatedPreferences]: The proposed [UserContentPreferences] object.

0 commit comments

Comments
 (0)