smart_review_prompter 1.1.0
smart_review_prompter: ^1.1.0 copied to clipboard
A smart way to show in-app review prompts based on user engagement, such as app open count and days since install.
Smart Review Prompter #
A simple, smart way to show in-app review prompts in Flutter based on user engagement metrics such as app open count and days since install.
Why Use This Package? #
Asking users for reviews at the right time significantly increases the chances of getting positive reviews. This package helps you:
- ✅ Ask for reviews only after users have actually engaged with your app
- ✅ Track app opens and install date automatically
- ✅ Ensure the review prompt is shown only once
- ✅ Wrap
in_app_reviewandshared_preferencesin one simple API - ✅ Customize conditions based on your app's needs
Features #
- 🎯 Smart Timing: Show review prompts based on app opens and days since install
- 🔒 One-Time Prompt: Automatically tracks if a review has already been requested
- 📊 Automatic Tracking: Counts app opens and stores install date
- 🎨 Simple API: Just three methods to integrate
- 🚀 Native Experience: Uses the official platform review dialogs (iOS App Store & Google Play)
Installation #
Add this to your pubspec.yaml:
dependencies:
smart_review_prompter: ^1.1.0
Then run:
flutter pub get
Usage #
Step 1: Initialize in main.dart #
import 'package:flutter/material.dart';
import 'package:smart_review_prompter/smart_review_prompter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize the package
await SmartReviewPrompter.instance.initialize();
// Increment app open count
await SmartReviewPrompter.instance.incrementAppOpenCount();
runApp(const MyApp());
}
Step 2: Trigger Review at the Right Moment #
Call this method when users complete a positive action (e.g., finish a level, complete a task, make a purchase):
SmartReviewPrompter.instance.tryShowingReview(
SmartReviewConditions(
minAppOpens: 5, // Show after 5 app opens
minDaysSinceInstall: 3, // Show after 3 days since install
),
);
Complete Example #
import 'package:flutter/material.dart';
import 'package:smart_review_prompter/smart_review_prompter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await SmartReviewPrompter.instance.initialize();
await SmartReviewPrompter.instance.incrementAppOpenCount();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Smart Review Example'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
// Trigger after a positive user action
SmartReviewPrompter.instance.tryShowingReview(
SmartReviewConditions(
minAppOpens: 5,
minDaysSinceInstall: 3,
),
);
},
child: const Text('Complete Positive Action'),
),
),
),
);
}
}
API Reference #
SmartReviewPrompter.instance #
The singleton instance of the prompter.
Methods
initialize()
Initializes the package and sets up storage. Call this once in main() before runApp().
await SmartReviewPrompter.instance.initialize();
incrementAppOpenCount()
Increments the app open counter. Call this in main() after initialize().
await SmartReviewPrompter.instance.incrementAppOpenCount();
tryShowingReview(SmartReviewConditions conditions)
Checks if conditions are met and shows the review prompt if appropriate. This legacy method only triggers the prompt once.
SmartReviewPrompter.instance.tryShowingReview(
SmartReviewConditions(
minAppOpens: 5,
minDaysSinceInstall: 3,
),
);
tryShowingReviewWithLimit({required SmartReviewConditions conditions, int maxPromptCount = 3, int minDaysBetweenPrompts = 14, int minOpensBetweenPrompts = 10})
Checks conditions and shows the review prompt up to maxPromptCount times. This is the recommended method if you want to reprompt users who may have dismissed the review dialog before.
conditions: Initial conditions required to show the prompt (opens & days).maxPromptCount: The absolute maximum times the prompt should be shown (default: 3).minDaysBetweenPrompts: Wait period in days before prompting again if previously closed or ignored (default: 14).minOpensBetweenPrompts: Wait period in app opens before prompting again (default: 10).
SmartReviewPrompter.instance.tryShowingReviewWithLimit(
conditions: SmartReviewConditions(
minAppOpens: 5,
minDaysSinceInstall: 3,
),
maxPromptCount: 3, // Prompt up to 3 times
minDaysBetweenPrompts: 14, // Wait 14 days between prompts
minOpensBetweenPrompts: 10, // Wait 10 app opens between prompts
);
markUserAsRated()
Call this when you know the user has already rated the app (e.g., if you show an in-app "Enjoying the app? Yes / No" popup first, or if they click a "Rate Now" button inside your settings screen). This permanently disables all future prompts.
await SmartReviewPrompter.instance.markUserAsRated();
reset()
Clears all stored parameters (app opens, install date, prompt counts, last prompt date). Very useful for debugging and testing.
await SmartReviewPrompter.instance.reset();
Utility Getters
You can programmatically query the status of metrics for custom UI logic:
Future<int> getAppOpenCount(): Number of times the app was opened.Future<int> getDaysSinceInstall(): Days passed since first install.Future<bool> hasUserAlreadyRated(): Whether the user has been marked as rated.Future<int> getPromptCount(): Number of times the prompt was shown.Future<DateTime?> getLastPromptDate(): Date and time of the last prompt.
SmartReviewConditions #
Configuration class for review conditions.
Parameters
minAppOpens(int, default: 5): Minimum number of app opens requiredminDaysSinceInstall(int, default: 3): Minimum days since first install required
Best Practices #
When to Ask for Reviews #
✅ Good Times:
- After completing a level or achievement
- After a successful transaction
- After using a key feature multiple times
- After receiving positive feedback in-app
❌ Bad Times:
- Immediately on app launch
- During user onboarding
- When user is trying to complete a task
- After an error or crash
Recommended Settings #
// For casual apps (games, social)
SmartReviewConditions(
minAppOpens: 5,
minDaysSinceInstall: 3,
)
// For productivity apps
SmartReviewConditions(
minAppOpens: 10,
minDaysSinceInstall: 7,
)
// For professional tools
SmartReviewConditions(
minAppOpens: 15,
minDaysSinceInstall: 14,
)
Platform Support #
- ✅ iOS (uses SKStoreReviewController)
- ✅ Android (uses Google Play In-App Review API)
- ⚠️ Web, Windows, macOS, Linux: Review dialog won't show (gracefully handled)
Note: The review prompt will not appear in simulators/emulators. Always test on real devices.
Testing #
For testing purposes, you can set low thresholds:
SmartReviewConditions(
minAppOpens: 2, // Easy to reach
minDaysSinceInstall: 0, // No wait time
)
To reset the package state during development:
- Uninstall and reinstall the app, or
- Clear app data from device settings
How It Works #
- First Launch: Records install date and initializes app open counter
- Every Launch: Increments the app open counter
- On Trigger: Checks if:
- App has been opened enough times
- Enough days have passed since install
- Review hasn't been requested before
- Shows Review: Uses native platform dialogs (won't interrupt if unavailable)
- Marks as Requested: Never asks again
Dependencies #
This package wraps:
in_app_review: For native review promptsshared_preferences: For persistent storage
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
Issues and Feedback #
Please file issues, bugs, or feature requests on our GitHub Issues page.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author #
Satish Parmar
⭐ If you like this package, please give it a star on GitHub! ⭐