app_reviews
a flutter plugin for requesting and writing reviews for the app store and google play.
how to use
it’s important to note that the app id must match the app id in google play and itunes connect. this can be changed in the info.plist on ios and app/build.gradle on android. you will use this app id for other services like firebase, admob and publishing the app.
android
navigates to store listing in google play
ios
for requesting reviews it is managed by apple. you can call the code on the page load and if the user has “rate in apps” turned on apple will send the request for the review pop up.
in debug mode it will always display.
this is the required way for requesting reviews after ios 10.3.
import 'dart:io';
import 'package:app_review/app_review.dart';
import 'package:flutter/material.dart';
@override
void initstate() {
super.initstate();
if (platform.isios) {
appreview.requestreview.then((onvalue) {
print(onvalue);
});
}
}
example
import 'package:app_review/app_review.dart';
import 'package:flutter/material.dart';
void main() => runapp(new myapp());
class myapp extends statefulwidget {
@override
_myappstate createstate() => new _myappstate();
}
class _myappstate extends state<myapp> {
@override
initstate() {
super.initstate();
appreview.getappid.then((onvalue) {
setstate(() {
appid = onvalue;
});
print("app id" + appid);
});
}
string appid = "";
string output = "";
@override
widget build(buildcontext context) {
return new materialapp(
home: new scaffold(
appbar: new appbar(
title: new text('app review'),
),
body: new singlechildscrollview(
child: new listbody(
children: <widget>[
new container(
height: 40.0,
),
new listtile(
leading: new icon(icons.info),
title: new text('app id'),
subtitle: new text(appid),
ontap: () {
appreview.getappid.then((onvalue) {
setstate(() {
output = onvalue;
});
print(onvalue);
});
},
),
new divider(
height: 20.0,
),
new listtile(
leading: new icon(
icons.shop,
),
title: new text('view store page'),
ontap: () {
appreview.storelisting.then((onvalue) {
setstate(() {
output = onvalue;
});
print(onvalue);
});
},
),
new divider(
height: 20.0,
),
new listtile(
leading: new icon(
icons.star,
),
title: new text('request review'),
ontap: () {
appreview.requestreview.then((onvalue) {
setstate(() {
output = onvalue;
});
print(onvalue);
});
},
),
new divider(
height: 20.0,
),
new listtile(
leading: new icon(
icons.note_add,
),
title: new text('write a new review'),
ontap: () {
appreview.writereview.then((onvalue) {
setstate(() {
output = onvalue;
});
print(onvalue);
});
},
),
new divider(
height: 20.0,
),
new listtile(
title: new text(output),
),
],
),
),
),
);
}
}
Comments are closed.