masamune_app_review 3.0.29 copy "masamune_app_review: ^3.0.29" to clipboard
masamune_app_review: ^3.0.29 copied to clipboard

unlisted

Plug-in for Masamune that provides a app review function.

Masamune logo

Masamune App Review

Follow on GitHub Follow on X Follow on YouTube Maintained with Melos

GitHub Sponsor


[GitHub] | [YouTube] | [Packages] | [X] | [LinkedIn] | [mathru.net]


Masamune App Review #

Usage #

Installation #

Add the package to your project.

flutter pub add masamune_app_review

Run flutter pub get if you edited pubspec.yaml manually.

Register the Adapter #

Register AppReviewMasamuneAdapter before launching the application. Provide the store URLs that open as fallback when in-app review dialogs are unavailable.

// lib/adapter.dart

/// Masamune adapters used by the app.
final masamuneAdapters = <MasamuneAdapter>[
  const UniversalMasamuneAdapter(),

  const AppReviewMasamuneAdapter(
    // Android: Google Play Store URL (required for Android fallback)
    googlePlayStoreUrl: "https://play.google.com/store/apps/details?id=com.example.app",
    
    // iOS: App Store URL (required for iOS fallback)
    appStoreUrl: "https://apps.apple.com/app/id0000000000",
  ),
];
  1. Use in your main.dart:
void main() {
  runMasamuneApp(
    appRef: appRef,
    masamuneAdapters: masamuneAdapters,
    (appRef, _) => MasamuneApp(
      appRef: appRef,
      home: HomePage(),
    ),
  );
}

The adapter registers itself in MasamuneAdapterScope, allowing access via AppReviewMasamuneAdapter.primary.

Request a Review #

Use the AppReview controller to trigger in-app review dialogs. If the platform cannot display the native dialog, the controller automatically falls back to launching the configured store URL.

Basic Usage:

class MyPage extends PageScopedWidget {
  @override
  Widget build(BuildContext context, PageRef ref) {
    final appReview = ref.page.controller(AppReview.query());

    return ElevatedButton(
      onPressed: () async {
        await appReview.review();
      },
      child: const Text("Review this app"),
    );
  }
}

Error Handling:

review() throws exceptions when:

  • Review is not supported on the platform (e.g., web)
  • The store URL cannot be opened

Handle exceptions for custom fallback logic:

try {
  await appReview.review();
} catch (e) {
  debugPrint("Review failed: $e");
  // Show custom message to user
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(content: Text("Could not open review dialog")),
  );
}

Advanced Usage #

Check Availability: Check if native review is available before prompting:

import 'package:in_app_review/in_app_review.dart';

if (await InAppReview.instance.isAvailable()) {
  // Show review prompt UI
  showDialog(...);
} else {
  // Direct to store URL
  await appReview.review();
}

Direct Store URLs: Access store URLs directly for custom link building:

final adapter = AppReviewMasamuneAdapter.primary;
final iosUrl = adapter.appStoreUrl;
final androidUrl = adapter.googlePlayStoreUrl;

// Use in your custom UI or share dialog

Analytics Integration: Wrap review calls for tracking:

await appReview.review();
analytics.logEvent(name: "app_review_requested");

GitHub Sponsors #

Sponsors are always welcome. Thank you for your support!

https://github.com/sponsors/mathrunet

0
likes
0
points
374
downloads

Publisher

verified publishermathru.net

Weekly Downloads

Plug-in for Masamune that provides a app review function.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, in_app_review, katana, masamune, url_launcher

More

Packages that depend on masamune_app_review