in_app_review_kmp 1.0.6 in_app_review_kmp: ^1.0.6 copied to clipboard
Plugin that allows to launch in-app and in-market review flows. Build over KMP
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:in_app_review_kmp/in_app_review.dart';
import 'package:in_app_review_kmp/in_app_review_params.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _inAppReviewPlugin = InAppReview();
@override
void initState() {
super.initState();
initPlatformState();
}
Future<void> initPlatformState() async {
String platformVersion;
try {
platformVersion = await _inAppReviewPlugin
.launchInMarketReview(
InAppReviewParams(
androidParams: AndroidParams(
market: AndroidMarket.appGallery,
),
iosParams: IOSParams(appStoreId: "12345"),
),
)
.then((value) => value.name);
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}