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
flutter pub add permitplane_client permitplane_flutterPut permitplane.json in assets/ and register it in pubspec.yaml:
flutter:
assets:
- assets/permitplane.json2. Activate
Initialize once at startup. The SDK loads saved rights from protected storage.
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:
final result = await PPLicense.activate(key);
if (!result.ok) showMessage(result.message!);3. Unlock features
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:
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
- Sign in, verify your email and turn on MFA.
- Create your business and add a sandbox product.
- Publish its policy: installations per licence, trial length (14 days by default) and offline days.
- Optionally, describe what each licence unlocks with entitlements (example below).
- Issue a test licence with a reference such as
customer-001and a paid-through date. - Copy the licence key.
{
"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_clientis the protocol client.permitplane_flutterholds the Windows and Android adapters.- The client config holds no secrets. Ship it as an app asset.
Platform adapters
nativeInstallationPlatformpicks 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. AndroidInstallationPlatformkeeps state in the app's private no-backup directory.- Other platforms implement the
InstallationPlatforminterface.
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,
pendingOfflineDeactivationholds it.
Try the honest-customer path
- Activate, go offline and restart the app. The cached signed access keeps working.
- Reconnect and refresh.
- 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.