@@ -7,9 +7,12 @@ abstract class UserPreferenceLimitService {
7
7
/// {@macro user_preference_limit_service}
8
8
const UserPreferenceLimitService ();
9
9
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,
11
11
/// considering their current count of that item type and their role.
12
12
///
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
+ ///
13
16
/// - [user] : The authenticated user.
14
17
/// - [itemType] : The type of item being added (e.g., 'country', 'source',
15
18
/// 'category', 'headline').
@@ -19,8 +22,13 @@ abstract class UserPreferenceLimitService {
19
22
/// limit for their role.
20
23
Future <void > checkAddItem (User user, String itemType, int currentCount);
21
24
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).
24
32
///
25
33
/// - [user] : The authenticated user.
26
34
/// - [updatedPreferences] : The proposed [UserContentPreferences] object.
0 commit comments