Skip to content

Test mode in your app

Your app’s test app has its own key (app_test_…), contacts and data (Test mode). Nothing in your code changes for it: a staging build sends the test app’s key, against the same address.

final config = CrmConfig(
apiBase: Uri.parse('https://app.purrcrm.com'),
appKey: const String.fromEnvironment('CRM_APP_KEY'),
appVersion: '1.4.0',
);
Terminal window
flutter build appbundle --release --dart-define=CRM_APP_KEY=app_... # what your users install
flutter run --dart-define=CRM_APP_KEY=app_test_... # staging

Find both keys on Settings › Connect › Install: switch Live | Test to see the test app’s.

The test app checks tokens with its own sign-in. Your staging backend signs with the test app’s identity secret (crm_is_test_…, on the Sign-in tab in Test). A staging token sent with the live key, or a live token with the test key, is refused with a sentence saying which, and the package does not keep asking for new tokens.

Pushes go through the test app’s own Firebase key (your staging Firebase project), to the devices your staging build registered. Emails go only to addresses on the test app’s allow-list; the rest wait in the Test outbox.

  • crm.isTestMode says whether the build is in test mode: from the app’s public face once PurrCRM has answered, and from the key’s prefix until then.

  • CrmTestModeBanner puts a small “CRM TEST” ribbon across a corner of a debug build in test mode, as Flutter’s DEBUG banner does. A release build never draws it:

    builder: (context, child) => CrmTestModeBanner(
    child: CrmOverlay(navigatorKey: navigatorKey, child: child!),
    ),
  • A release build with a test key writes a warning to the log once as it starts, and carries on: a staging key in what your users install would put all of them in the test app.