2

I am trying to integrate the rate_my_app package with my flutter app. I have tried all the versions and the same problem occurs: cant find parameter onRatingChanged.I need to create a pop-up rating dialog and I don't mind using any other packages or classes or fix this one, I also get this error after using the code provided by rate_my_app

The following NoSuchMethodError was thrown attaching to the render tree: I/flutter (13365): The getter 'millisecondsSinceEpoch' was called on null. I/flutter (13365): Receiver: null I/flutter (13365): Tried calling: millisecondsSinceEpoch

My Code in main.dart

 RateMyApp rateMyApp = RateMyApp(
preferencesPrefix: 'rateMyApp_',
minDays: 1,
minLaunches: 1,


);



 @override
  void initState() {
    super.initState();
    if(rateMyApp.shouldOpenDialog){
      rateMyApp.showRateDialog(context,title: 'hii', message: 'please like');
    }
Saeed
  • 67
  • 1
  • 9

2 Answers2

0

As noted in this thread, try to fix the version of smooth_star_rating dependency to strictly equal to 1.0.4+2. Or change it to ^1.1.0.

madhead
  • 31,729
  • 16
  • 153
  • 201
0

Please, use actionsBuilder rather than onRatingChanged. it was replaced in the latest packages.

_rateMyApp.init().then((_) {
  if (_rateMyApp.shouldOpenDialog) {
    _rateMyApp.showStarRateDialog(
      context,
      actionsBuilder: (context, stars) {
        return [
          FlatButton(
            onPressed: () {
              if (stars != null) {
                _rateMyApp.save().then((v) => Navigator.pop(context));

                if (stars <= 3) {
                  print("User Selected $stars");
                } else if (stars <= 5) {
                  print('Leave a Review Dialog');
                }
              } else {
                Navigator.pop(context);
              }
            },
            child: Text('OK'),
          )
        ];
      },
      title: "Have you made someone happy today?",
      message: "Please, review our app with 5 starts and make us happy",
      dialogStyle: DialogStyle(
          titleAlign: TextAlign.center,
          messageAlign: TextAlign.center,
          messagePadding: EdgeInsets.only(bottom: 20.0)),
      starRatingOptions: StarRatingOptions(),
    );
  }
});

}

Omad
  • 43
  • 4