Ezi Comments for Flutter
Add Ezi Comments to a Flutter app so reviewers can comment on its screens, on iOS and Android. Read the overview first for how it works and what you need in the dashboard.
Requirements
- Flutter 3.47 or newer with Dart 3.13.
- An iOS or Android app. The review screens bring their own theme, so the SDK works whether your app uses
package:material_uiorpackage:flutter/material.dart. - Your project key (dashboard, Widget key).
- Your app on the project's Allowed apps page: the iOS bundle id with the platform set to iOS, and the Android application id with the platform set to Android.
Install
The SDK is the Dart package ezi_comments. It is not on pub.dev yet; email damianosdev@gmail.com for the package and add it to pubspec.yaml from the folder you receive:
dependencies:
ezi_comments:
path: path/to/ezi_comments
Then run flutter pub get.
Set up
Wrap your app with EziReview in MaterialApp.builder and add EziNavigatorObserver. Turn review on only in debug or internal builds:
import 'package:ezi_comments/ezi_comments.dart';
import 'package:flutter/foundation.dart';
// On in debug builds, and in any build made with --dart-define=EZI_REVIEW=true.
const reviewEnabled = bool.fromEnvironment('EZI_REVIEW', defaultValue: kDebugMode);
MaterialApp(
navigatorObservers: [EziNavigatorObserver()],
builder: (context, child) => EziReview(
config: EziConfig(
projectKey: 'pk_your-project-key',
endpoint: 'https://comments.example.com',
app: EziAppInfo(appId: 'com.example.shop', appVersion: '2.4.0', build: '412'),
enabled: reviewEnabled,
launcher: true, // floating button
shakeToOpen: true, // shake to open
),
child: child!,
),
);
projectKey: the key from Widget key.endpoint: the address of your Ezi Comments dashboard, without a path.app: your app id, version and build, sent with each comment.appIdmust match an entry on Allowed apps.enabled: withfalse,EziReviewjust returns your app: no button, no requests.
Store builds leave review off; build an internal version with it on, for example flutter build ipa --dart-define=EZI_REVIEW=true.
EziConfig and EziAppInfo throw an EziConfigurationError if a value is not valid; the message says which rule failed.
Open review mode
Pick one or more ways for reviewers to open it:
launcher: trueshows a floating button. Reviewers can drag it anywhere; it stays where they drop it and never appears in screenshots. Off by default.shakeToOpen: trueopens review mode when the device is shaken. Off by default.- Call the SDK from your own code, for example a debug menu entry:
EziComments.show(); // capture the current screen and open review mode
EziComments.hide(); // close it
EziComments.signOut(); // sign the reviewer out
Name your screens
Comments are grouped by screen. The SDK picks the name in this order:
- the nearest visible
EziScreen, or a name set withEziComments.setScreen('checkout'); - the
screenIdcallback ofEziReview; - the last named route seen by
EziNavigatorObserver; unknown.
EziScreen(id: 'checkout', child: CheckoutPage())
With GoRouter, add the observer to the router (GoRouter(observers: [EziNavigatorObserver()])), or return the route pattern from the callback:
EziReview(
config: config,
screenId: () => router.state.fullPath, // such as /orders/:id
child: child!,
);
Names are 1 to 200 characters.
To tell developers which element a comment is about, wrap important widgets in EziViewHint. A pin inside it records its id:
EziViewHint(id: 'checkout.pay', child: PayButton())
Protect sensitive content
Wrap widgets that must not appear in screenshots in EziRedact. Their area is filled before the image is encoded:
EziRedact(child: Text(balance))
You can also mask a widget by its key with EziComments.redact(key). To skip screenshots on whole screens, add shouldCapture to EziConfig; reviewers can still comment there, and the comment posts without a screenshot:
shouldCapture: (screenId) => screenId != 'payment',
On Android, windows with FLAG_SECURE are never captured. Dialogs and bottom sheets are included in the screenshot; the SDK's own button and review screens are not. Platform views such as maps, web views and video appear blank.
Android backup
The reviewer's sign-in is kept with flutter_secure_storage. On Android, your app's automatic backup can copy its files, so exclude the shared preferences files FlutterSecureStorage.xml and FlutterSecureKeyStorage.xml from backup (with android:fullBackupContent, and android:dataExtractionRules for Android 12 and later), or set android:allowBackup="false". Then a restored device never carries a reviewer's sign-in.
Check that it works
- Add your app ids under Allowed apps and turn on Screenshots on the project's General page.
- Run a debug build (
flutter run) and open review mode. - Turn on Comment, tap anywhere on the screen, type a comment and tap Post.
- Sign in with your email and the 6-digit code.
- Open the project's Threads in the dashboard: the comment is there with the screenshot and your device details.
Troubleshooting
- "This app can't post comments": the
appIdinEziAppInfois not on Allowed apps for this platform. Add the iOS bundle id and the Android application id as separate entries, and make sureappIdreports the right one on each platform. - Nothing appears in a release or profile build: review is off unless the build was made with
--dart-define=EZI_REVIEW=true. - Screens are filed as
unknown: addEziNavigatorObserverto your navigator or router, name your routes, or useEziScreen. - Testing against a server on your own computer:
httpis accepted forlocalhost,127.0.0.1and[::1], and in debug builds also for private-network addresses (such as192.168.x.x) and.localnames. From an Android emulator, forward the port withadb reverse tcp:PORT tcp:PORTand usehttp://127.0.0.1:PORT.
Other messages reviewers may see are explained in the overview.