Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: No named parameter with the name 'onRatingChanged'

I try to run the app but I receive these errors :

Compiler message:
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.6.0+2/lib/src/dialogs.dart:272:17: Error: No named parameter with the name 'onRatingChanged'.
                onRatingChanged: (rating) {
                ^^^^^^^^^^^^^^^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/smooth_star_rating-1.1.0+1/lib/smooth_star_rating.dart:23:3: Context: Found this candidate, but the arguments don't match.
  SmoothStarRating({
  ^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script '/Users/ahmed/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 896

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/ahmed/Developer/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Is there any solution to workaround it?

like image 600
Alex Ali Avatar asked May 14 '20 18:05

Alex Ali


2 Answers

Update the version of rate_my_app to 0.6.0+3 in pubspec.yaml

enter image description here

like image 124
Ninja InfoTech Support Avatar answered Nov 15 '22 06:11

Ninja InfoTech Support


Use actionsBuilder instead of 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(),
    );
  }
});

}

like image 40
Omad Avatar answered Nov 15 '22 06:11

Omad