{"id":16216725,"url":"https://github.com/skyost/ratemyapp","last_synced_at":"2025-04-04T10:07:45.064Z","repository":{"id":40001339,"uuid":"182830573","full_name":"Skyost/RateMyApp","owner":"Skyost","description":"This plugin allows to kindly ask users to rate your app if custom conditions are met (eg. install time, number of launches, etc...).","archived":false,"fork":false,"pushed_at":"2024-05-24T09:33:19.000Z","size":697,"stargazers_count":276,"open_issues_count":12,"forks_count":113,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-09T04:03:51.429Z","etag":null,"topics":["app-rating","flutter","flutter-plugin","flutter-plugins","rating"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/rate_my_app","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Skyost.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Skyost","patreon":null,"open_collective":null,"ko_fi":"Skyost","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["paypal.me/Skyost"]}},"created_at":"2019-04-22T16:58:20.000Z","updated_at":"2024-11-08T19:58:08.000Z","dependencies_parsed_at":"2022-07-22T09:52:45.116Z","dependency_job_id":"2ad04546-306c-4c1f-8a7a-f2d0fdc65cf5","html_url":"https://github.com/Skyost/RateMyApp","commit_stats":{"total_commits":152,"total_committers":14,"mean_commits":"10.857142857142858","dds":0.3421052631578947,"last_synced_commit":"2e2941462c8c3b7e770beaa2bcfe457d96d35eb7"},"previous_names":["skyost/rate_my_app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyost%2FRateMyApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyost%2FRateMyApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyost%2FRateMyApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Skyost%2FRateMyApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Skyost","download_url":"https://codeload.github.com/Skyost/RateMyApp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157281,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-rating","flutter","flutter-plugin","flutter-plugins","rating"],"created_at":"2024-10-10T11:21:56.601Z","updated_at":"2025-04-04T10:07:45.047Z","avatar_url":"https://github.com/Skyost.png","language":"Dart","funding_links":["https://github.com/sponsors/Skyost","https://ko-fi.com/Skyost","paypal.me/Skyost","https://paypal.me/Skyost"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/Skyost/RateMyApp/raw/master/images/logo.svg\" height=\"200\"\u003e\n\u003c/div\u003e\n\n# Rate my app !\n\nThis plugin allows to kindly ask users to rate your app if custom conditions are met (eg. install time, number of launches, etc...).\nYou can even add your own conditions.\n\n_Rate my app_ is really inspired by [Android-Rate](https://github.com/hotchemi/Android-Rate/).\n\n## How to use\n\n### Installation\n\nIt's important that your bundle identifier (in your `Info.plist`) match the App ID on iTunes Connect and the package identifier (in your `build.gradle`) match your App ID on Google Play.\nIf for any reason it doesn't match please go to the _[Using custom identifiers](#using-custom-identifiers)_ section.\n\n### How it works\n\n_Rate my app_ default constructor takes two main parameters (see _[Example](#example)_ for more info) :\n\n* `minDays` Minimum elapsed days since the first app launch.\n* `minLaunches` Minimum app launches count.\n\nIf everything above is verified, the method `shouldOpenDialog` will return `true` (`false` otherwise).\nThen you should call `showRateDialog` which is going to show a native rating dialog, if supported, or a custom rating prompt dialog.\n\nIf you prefer, you can call `showStarRateDialog` which will more or less do the same, but is able to fallback on a dialog containing a star rating bar.\nIt allows you to take custom actions based on the rating (for example if the user puts less than 3 stars then open your app bugs report page or something like this and if he puts more ask him to rate your app on the store page).\nStill, you have to be careful with these practises (see [this paragraph](https://appradar.com/blog/ask-users-leave-review-in-app-stores#fraudulent-methods-to-gain-more-app-store-reviews) on App Radar).\n\n## Screenshots\n\n\u003cdetails\u003e\n    \u003csummary\u003eOn Android\u003c/summary\u003e\n    \u003cimg src=\"https://github.com/Skyost/RateMyApp/raw/master/images/android.png\" height=\"500\"\u003e\n    \u003cbr\u003e\u003cem\u003e\u003ccode\u003eshowRateDialog\u003c/code\u003e method with \u003ccode\u003eignoreNative\u003c/code\u003e set to \u003ccode\u003etrue\u003c/code\u003e.\u003c/em\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eOn iOS\u003c/summary\u003e\n    \u003cimg src=\"https://github.com/Skyost/RateMyApp/raw/master/images/ios_10_3.png\" height=\"500\"\u003e\n    \u003cbr\u003e\u003cem\u003e\u003ccode\u003eshowRateDialog\u003c/code\u003e and \u003ccode\u003eshowStarRateDialog\u003c/code\u003e methods with \u003ccode\u003eignoreNative\u003c/code\u003e set to \u003ccode\u003efalse\u003c/code\u003e.\u003c/em\u003e\n\u003c/details\u003e\n\n## Using it in your code\n\n### Code snippets\n\n```dart\n// In this snippet, I'm giving a value to all parameters.\n// Please note that not all are required (those that are required are marked with the @required annotation).\n\nRateMyApp rateMyApp = RateMyApp(\n  preferencesPrefix: 'rateMyApp_',\n  minDays: 7,\n  minLaunches: 10,\n  remindDays: 7,\n  remindLaunches: 10,\n  googlePlayIdentifier: 'fr.skyost.example',\n  appStoreIdentifier: '1491556149',\n);\n\nrateMyApp.init().then((_) {\n  if (rateMyApp.shouldOpenDialog) {\n    rateMyApp.showRateDialog(\n      context,\n      title: 'Rate this app', // The dialog title.\n      message: 'If you like this app, please take a little bit of your time to review it !\\nIt really helps us and it shouldn\\'t take you more than one minute.', // The dialog message.\n      rateButton: 'RATE', // The dialog \"rate\" button text.\n      noButton: 'NO THANKS', // The dialog \"no\" button text.\n      laterButton: 'MAYBE LATER', // The dialog \"later\" button text.\n      listener: (button) { // The button click listener (useful if you want to cancel the click event).\n        switch(button) {\n          case RateMyAppDialogButton.rate:\n            print('Clicked on \"Rate\".');\n            break;\n          case RateMyAppDialogButton.later:\n            print('Clicked on \"Later\".');\n            break;\n          case RateMyAppDialogButton.no:\n            print('Clicked on \"No\".');\n            break;\n        }\n        \n        return true; // Return false if you want to cancel the click event.\n      },\n      ignoreNativeDialog: Platform.isAndroid, // Set to false if you want to show the Apple's native app rating dialog on iOS or Google's native app rating dialog (depends on the current Platform).\n      dialogStyle: const DialogStyle(), // Custom dialog styles.\n      onDismissed: () =\u003e rateMyApp.callEvent(RateMyAppEventType.laterButtonPressed), // Called when the user dismissed the dialog (either by taping outside or by pressing the \"back\" button).\n      // contentBuilder: (context, defaultContent) =\u003e content, // This one allows you to change the default dialog content.\n      // actionsBuilder: (context) =\u003e [], // This one allows you to use your own buttons. \n    );\n    \n    // Or if you prefer to show a star rating bar (powered by `flutter_rating_bar`) :\n    \n    rateMyApp.showStarRateDialog(\n      context,\n      title: 'Rate this app', // The dialog title.\n      message: 'You like this app ? Then take a little bit of your time to leave a rating :', // The dialog message.\n      // contentBuilder: (context, defaultContent) =\u003e content, // This one allows you to change the default dialog content.\n      actionsBuilder: (context, stars) { // Triggered when the user updates the star rating.\n        return [ // Return a list of actions (that will be shown at the bottom of the dialog).\n          FlatButton(\n            child: Text('OK'),\n            onPressed: () async {\n              print('Thanks for the ' + (stars == null ? '0' : stars.round().toString()) + ' star(s) !');\n              // You can handle the result as you want (for instance if the user puts 1 star then open your contact page, if he puts more then open the store page, etc...).\n              // This allows to mimic the behavior of the default \"Rate\" button. See \"Advanced \u003e Broadcasting events\" for more information :\n              await rateMyApp.callEvent(RateMyAppEventType.rateButtonPressed);\n              Navigator.pop\u003cRateMyAppDialogButton\u003e(context, RateMyAppDialogButton.rate);\n            },\n          ),\n        ];\n      },\n      ignoreNativeDialog: Platform.isAndroid, // Set to false if you want to show the Apple's native app rating dialog on iOS or Google's native app rating dialog (depends on the current Platform).\n      dialogStyle: const DialogStyle( // Custom dialog styles.\n        titleAlign: TextAlign.center,\n        messageAlign: TextAlign.center,\n        messagePadding: EdgeInsets.only(bottom: 20),\n      ),\n      starRatingOptions: const StarRatingOptions(), // Custom star bar rating options.\n      onDismissed: () =\u003e rateMyApp.callEvent(RateMyAppEventType.laterButtonPressed), // Called when the user dismissed the dialog (either by taping outside or by pressing the \"back\" button).\n    );\n  }\n});\n```\n\n### Minimal Example\n\nBelow is the minimal code example. This will be for the basic minimal working of this plugin.\nThe code below will launch a simple message popup after the defined minimal days/minimal launches along with the default buttons :\n_Rate_, _Maybe later_ and _Cancel_, with their default behavior.\n\nPlace this in your main widget state :\n\n```dart\nRateMyApp rateMyApp = RateMyApp(\n  preferencesPrefix: 'rateMyApp_',\n  minDays: 0, // Show rate popup on first day of install.\n  minLaunches: 5, // Show rate popup after 5 launches of app after minDays is passed.\n);\n\n@override\nvoid initState() {\n  super.initState();\n\n  WidgetsBinding.instance.addPostFrameCallback((_) async {\n    await rateMyApp.init();\n    if (mounted \u0026\u0026 rateMyApp.shouldOpenDialog) {  \n      rateMyApp.showRateDialog(context);\n    }\n  });\n}\n```\n\nIf you want a more complete example, please check [this one](https://github.com/Skyost/RateMyApp/tree/master/example/) on Github.    \nYou can also follow [the tutorial of Marcus Ng](https://youtu.be/gOiaSwp984s) on YouTube\n(for a replacement of `doNotOpenAgain`, see [Broadcasting events](#broadcasting-events)).\n\n## Advanced\n\n### Where to initialize _Rate My App_\n\nYou should be careful on where you initialize _Rate My App_ in your project.\nBut thankfully, there's a widget that helps you getting through all of this without any trouble : `RateMyAppBuilder`.\nHere's an example :\n\n```dart\n// The builder should be initialized exactly one time during the app lifecycle.\n// So place it where you want but it should respect that condition.\n\nRateMyAppBuilder(\n  builder: (context) =\u003e MaterialApp(\n    home: Scaffold(\n      appBar: AppBar(\n        title: const Text('Rate my app !'),\n      ),\n      body: Center(child: Text('This is my beautiful app !')),\n    ),\n  ),\n  onInitialized: (context, rateMyApp) {\n    // Called when Rate my app has been initialized.\n    // See the example project on Github for more info.\n  },\n);\n```\n\nYou can totally choose to not use it and to initialize _Rate my app_ in your `main()` method. This is up to you !\n\n### Using custom identifiers\n\nIt's possible to use custom store identifiers ! Just pass the following parameters during the plugin initialization :\n\n* `googlePlayIdentifier` Your Google Play identifier (usually a package name).\n* `appStoreIdentifier` Your App Store identifier (usually numbers).\n\n### Using custom conditions\n\nA condition is something required to be met in order for the `shouldOpenDialog` method to return `true`.\n_Rate my app_ comes with three default conditions :\n\n* `MinimumDaysCondition` Allows to set a minimum elapsed days since the first app launch before showing the dialog.\n* `MinimumAppLaunchesCondition` Allows to set a minimum app launches count since the first app launch before showing the dialog.\n* `DoNotOpenAgainCondition` Allows to prevent the dialog from being opened (when the user clicks on the _No_ button for example).\n\nYou can easily create your custom conditions ! All you have to do is to extend the `Condition` class. There are five methods to implement :\n\n* `readFromPreferences` You should read your condition values from the provided shared preferences here.\n* `saveToPreferences` You should save your condition values to the provided shared preferences here.\n* `reset` You should reset your condition values here.\n* `isMet` Whether this condition is met.\n* `onEventOccurred` When an event occurs in the plugin lifecycle. This is usually here that you can update your condition values.\nPlease note that you're not obligated to override this one (although this is recommended).\n\nYou can have an easy example of it by checking the source code of [`DoNotOpenAgainCondition`](https://github.com/Skyost/RateMyApp/tree/master/lib/src/conditions.dart#L169).\n\nThen you can add your custom condition to _Rate my app_ by using the constructor `customConditions` (or by calling `rateMyApp.conditions.add` before initialization).\n\n### Broadcasting events\n\nAs said in the previous section, the `shouldOpenDialog` method depends on conditions.\n\nFor example, when you click on the _No_ button,\n[this event](https://github.com/Skyost/RateMyApp/tree/master/lib/src/core.dart#L237) will be triggered\nand the condition `DoNotOpenAgainCondition` will react to it and will stop being met and thus the `shouldOpenDialog` will return `false`.\n\nYou may want to broadcast events in order to mimic the behaviour of the _No_ button for example.\nThis can be done either by using the `RateMyAppNoButton` or you can directly call `callEvent` from your current _RateMyApp_ instance in your button `onTap` callback.\n\nHere are what events default conditions are listening to :\n\n* `MinimumDaysCondition` : _Later_ button press.\n* `MinimumAppLaunchesCondition` : _Rate my app_ initialization, _Later_ button press.\n* `DoNotOpenAgainCondition` : _Rate_ button press, _No_ button press.\n\nFor example, starting from version 0.5.0, the getter/setter `doNotOpenAgain` has been removed.\nYou must trigger the `DoNotOpenAgainCondition` either by calling a _Rate_ button press event or a _No_ button press event (see [Example on Github](https://github.com/Skyost/RateMyApp/blob/master/example/lib/content.dart#L141)).\n\n## Contributions\n\nYou have a lot of options to contribute to this project ! You can :\n\n* [Fork it](https://github.com/Skyost/RateMyApp/fork) on Github.\n* [Submit](https://github.com/Skyost/RateMyApp/issues/new/choose) a feature request or a bug report.\n* [Donate](https://paypal.me/Skyost) to the developer.\n\n## Dependencies\n\nThis library depends on `shared_preferences` (to store its state) and `flutter_rating_bar` (for\n`showRateDialog`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyost%2Fratemyapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyost%2Fratemyapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyost%2Fratemyapp/lists"}