rate_my_app 2.1.0 copy "rate_my_app: ^2.1.0" to clipboard
rate_my_app: ^2.1.0 copied to clipboard

Allows to kindly ask users to rate your app if custom conditions are met (eg. install time, number of launches, etc...).

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:rate_my_app/rate_my_app.dart';

import 'content.dart';

/// First plugin test method.
void main() {
  WidgetsFlutterBinding.ensureInitialized(); // This allows to use async methods in the main method without any problem.
  runApp(const _RateMyAppTestApp());
}

/// The body of the main Rate my app test widget.
class _RateMyAppTestApp extends StatefulWidget {
  /// Creates a new Rate my app test app instance.
  const _RateMyAppTestApp();

  @override
  State<StatefulWidget> createState() => _RateMyAppTestAppState();
}

/// The body state of the main Rate my app test widget.
class _RateMyAppTestAppState extends State<_RateMyAppTestApp> {
  /// The widget builder.
  WidgetBuilder builder = buildProgressIndicator;

  @override
  Widget build(BuildContext context) => MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: const Text('Rate my app !'),
          ),
          body: RateMyAppBuilder(
            rateMyApp: RateMyApp(
              googlePlayIdentifier: 'app.openauthenticator',
              appStoreIdentifier: '6479272927',
            ),
            builder: builder,
            onInitialized: (context, rateMyApp) {
              setState(() => builder = (context) => ContentWidget(rateMyApp: rateMyApp));
              for (Condition condition in rateMyApp.conditions) {
                if (condition is DebuggableCondition) {
                  print(condition.valuesAsString); // We iterate through our list of conditions and we print all debuggable ones.
                }
              }

              print('Are all conditions met ? ${rateMyApp.shouldOpenDialog ? 'Yes' : 'No'}');

              if (rateMyApp.shouldOpenDialog) {
                rateMyApp.showRateDialog(context);
              }
            },
          ),
        ),
      );

  /// Builds the progress indicator, allowing to wait for Rate my app to initialize.
  static Widget buildProgressIndicator(BuildContext context) => const Center(child: CircularProgressIndicator());
}
598
likes
150
points
25.8k
downloads

Publisher

verified publisherskyost.eu

Weekly Downloads

Allows to kindly ask users to rate your app if custom conditions are met (eg. install time, number of launches, etc...).

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_rating_bar, shared_preferences

More

Packages that depend on rate_my_app