StoreReviewRequester class
A class responsible for managing review requests for a store.
This class schedules and sends review requests based on specified review periods and a maximum review count. It interacts with the StoreReviewer to initiate review requests and uses a local database to track the last review request time and review count.
Example usage:
final reviewRequester = StoreReviewRequester(
firstReviewPeriod: Duration(days: 1),
reviewPeriod: Duration(days: 30),
maxReviewCount: 3,
storeReviewer: myStoreReviewer,
localDb: myLocalDb,
);
await reviewRequester.onLoad();
StoreReviewer.onLoad will be called during onLoad
Ensure proper initialization of firstReviewPeriod, reviewPeriod,
maxReviewCount, _storeReviewer
, and localDb.
- Inheritance
-
- Object
- ChangeNotifier
- StoreReviewRequester
Constructors
-
StoreReviewRequester({required LocalDbI localDb, StoreReviewer storeReviewer = const StoreReviewer(), Duration firstReviewPeriod = const Duration(days: 1), Duration reviewPeriod = const Duration(days: 15), int maxReviewCount = 3, ValueGetter<
Locale> ? getLocale}) - Creates an instance of StoreReviewRequester.
Properties
- firstReviewPeriod → Duration
-
The duration before the first review request.
final
-
getLocale
→ ValueGetter<
Locale> ? -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isAvailable ↔ bool
-
getter/setter pair
- localDb → LocalDbI
-
The local database interface for storing review request data.
final
- maxReviewCount → int
-
The maximum number of times a review can be requested.
final
- reviewPeriod → Duration
-
The duration between subsequent review requests.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Disposes of the timer to prevent memory leaks.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onLoad(
) → Future< void> - Initializes the review requester by checking the last review request time and review count.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
requestReview(
{BuildContext? context, Locale? locale}) → Future< void> - Requests a review from the store reviewer if the maximum count hasn't been reached.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited