update app_review

This commit is contained in:
2026-01-15 00:37:49 -08:00
parent 2e5f0f1ae1
commit a53ed330c5
70 changed files with 2227 additions and 2130 deletions
@@ -0,0 +1,24 @@
/// Base exception for AppReview package
class AppReviewException implements Exception {
final String message;
AppReviewException(this.message);
@override
String toString() => 'AppReviewException: $message';
}
/// Thrown when the review request fails
class AppReviewRequestFailedException extends AppReviewException {
AppReviewRequestFailedException(String message) : super(message);
}
/// Thrown when the review is unavailable
class AppReviewUnavailableException extends AppReviewException {
AppReviewUnavailableException(String message) : super(message);
}
/// Thrown when the store listing cannot be opened
class AppReviewStoreListingFailedException extends AppReviewException {
AppReviewStoreListingFailedException(String message) : super(message);
}
@@ -1,11 +0,0 @@
import '../app_review.dart';
/// Get app bundle name
Future<String?> getAppId() => AppReview.getBundleName();
/// Require app review for Android
Future<String?> openAndroidReview() => AppReview.openAndroidReview();
/// Open in GooglePlay
Future<String> openGooglePlay({String? fallbackUrl}) =>
AppReview.openGooglePlay(fallbackUrl: fallbackUrl);
@@ -1,17 +0,0 @@
import '../app_review.dart';
/// Returns Apple ID for iOS application.
///
/// If there is no such application in App Store - returns empty string.
Future<String?> getIosAppId(String appId, {String? countryCode}) async =>
AppReview.getIosAppId(bundleId: appId, countryCode: countryCode);
/// Open store page with action write review.
///
/// Supported only for iOS, on Android [storeListing] will be executed.
Future<String?> writeIosReview(String appId, {bool compose = false}) async =>
AppReview.openIosReview(appId: appId, compose: compose);
/// Open in AppStore
Future<String> openAppStore({String? fallbackUrl}) =>
AppReview.openAppStore(fallbackUrl: fallbackUrl);
+212
View File
@@ -0,0 +1,212 @@
// Autogenerated from Pigeon (v26.1.5), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers
import 'dart:async';
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
PlatformException _createConnectionError(String channelName) {
return PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel: "$channelName".',
);
}
class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is int) {
buffer.putUint8(4);
buffer.putInt64(value);
} else {
super.writeValue(buffer, value);
}
}
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
default:
return super.readValueOfType(type, buffer);
}
}
}
class AppReviewApi {
/// Constructor for [AppReviewApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
AppReviewApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
: pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
final String pigeonVar_messageChannelSuffix;
/// Request review.
///
/// Tells StoreKit / Play Store to ask the user to rate or review your app, if appropriate.
/// Supported only in iOS 10.3+ and Android with Play Services installed (see [isRequestReviewAvailable]).
///
/// Returns string with details message.
Future<String?> requestReview(bool testMode) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.app_review.AppReviewApi.requestReview$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[testMode]);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return (pigeonVar_replyList[0] as String?);
}
}
/// Check if [requestReview] feature available.
Future<bool> isRequestReviewAvailable() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.app_review.AppReviewApi.isRequestReviewAvailable$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else if (pigeonVar_replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (pigeonVar_replyList[0] as bool?)!;
}
}
/// Opens the store listing for the specified app.
///
/// [storeId] is the package name (Android) or App ID (iOS/macOS).
Future<void> openStoreListing(String? storeId) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.app_review.AppReviewApi.openStoreListing$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[storeId]);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
/// Opens the App Store review page (iOS/macOS only).
///
/// [storeId] is the App ID.
Future<void> openAppStoreReview(String? storeId) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.app_review.AppReviewApi.openAppStoreReview$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[storeId]);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
/// Returns package name for application.
Future<String> getBundleId() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.app_review.AppReviewApi.getBundleId$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else if (pigeonVar_replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (pigeonVar_replyList[0] as String?)!;
}
}
/// Requests the App ID from the App Store (via iTunes Lookup API).
///
/// [bundleId] is the bundle identifier to look up.
/// [countryCode] is the optional country code.
Future<String?> lookupAppId(String bundleId, String? countryCode) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.app_review.AppReviewApi.lookupAppId$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[bundleId, countryCode]);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return (pigeonVar_replyList[0] as String?);
}
}
}
@@ -1,9 +0,0 @@
import 'package:package_info_plus/package_info_plus.dart';
import '../app_review.dart';
/// Lazyload package info instance
Future<PackageInfo?> getPackageInfo() async => AppReview.getPackageInfo();
/// Get package bundle name
Future<String?> getPackageName() async => AppReview.getBundleName();