PermitPlane Docs
All docs pages

Add licensing to a Flutter app in five minutes

Your Windows or Android app activates a licence key and checks its features offline. On your product page, click Download permitplane.json and Create test key.

1. Install

Shell
flutter pub add permitplane_client permitplane_flutter

Put permitplane.json in assets/ and register it in pubspec.yaml:

YAML
flutter:
  assets:
    - assets/permitplane.json

2. Activate

Initialize once at startup. The SDK loads saved rights from protected storage.

Dart
import 'package:flutter/widgets.dart';
import 'package:permitplane_flutter/permitplane_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await PPLicense.initialize();
  runApp(const MyApp());
}

Let your customer enter the key delivered by your checkout or support team:

Dart
final result = await PPLicense.activate(key);
if (!result.ok) showMessage(result.message!);

3. Unlock features

Dart
if (PPLicense.isLicensed('export')) {
  enableExport();
} else {
  showUpgradeOffer();
}

Checks return immediately from verified local rights. When a refresh is due, the SDK requests it online. A network failure preserves access until the signed deadline. Listen to PPLicense.changes to update your UI.

4. Manage the installation

Use the shared client for limits, explicit refresh, release and offline files:

Dart
final workers = PPLicense.client!.getLimit('workers');
await PPLicense.client!.refresh(); // When the customer requests an online check.
await PPLicense.client!.release(); // Free this installation's device slot.
await PPLicense.dispose(); // Save the clock state before shutdown.

Show PPLicense.message if initialization or activation fails. Your customer needs no PermitPlane account. Configuration loads from the bundled asset.

Reference

Set up a sandbox product

  1. Sign in, verify your email and turn on MFA.
  2. Create your business and add a sandbox product.
  3. Publish its policy: installations per licence, trial length (14 days by default) and offline days.
  4. Optionally, describe what each licence unlocks with entitlements (example below).
  5. Issue a test licence with a reference such as customer-001 and a paid-through date.
  6. Copy the licence key.
JSON
{
  "export": {"type": "boolean", "value": true},
  "workers": {"type": "limit", "value": 3}
}

Your customer never needs a PermitPlane account. You deliver the key through your own checkout or support flow.

Packages

  • permitplane_client is the protocol client.
  • permitplane_flutter holds the Windows and Android adapters.
  • The client config holds no secrets. Ship it as an app asset.

Platform adapters

  • nativeInstallationPlatform picks the adapter for the current operating system.
  • WindowsInstallationPlatform(storageName: 'my-app') keeps DPAPI-protected state under %LOCALAPPDATA%\PermitPlane\my-app, with a filename derived from the product, environment and issuer namespace.
  • To retain an existing shared-directory Windows activation, keep WindowsInstallationPlatform.inLocalAppData('PermitPlane') as its client adapter.
  • AndroidInstallationPlatform keeps state in the app's private no-backup directory.
  • Other platforms implement the InstallationPlatform interface.

Offline files

  • createOfflineActivationRequest() returns a request file for the vendor.
  • importOfflineActivationResponse(text) stores the vendor's answer to it.
  • createOfflineDeactivationRequest() ends local rights at once.
  • Keep that file until the vendor has processed it. Until then, pendingOfflineDeactivation holds it.

Try the honest-customer path

  1. Activate, go offline and restart the app. The cached signed access keeps working.
  2. Reconnect and refresh.
  3. Release the installation to free the slot for another device.

Good to know

  • The client saves the clock state every minute while access is allowed.
  • Account-based trials, purchase connectors, webhooks and the API reference are in the docs for signed-in vendors. Sign in.