Installation
This guide walks you through adding the KLP Flutter SDK to your application.
Installation
This guide walks you through adding the KLP Flutter SDK to your application.
Before you begin
- Complete SDK onboarding and confirm your organization has repository access
- Ensure your application meets the system requirements
- Have a Flutter development environment configured on your machine or CI pipeline
Step 1 — Declare the dependency
Add the SDK to your application's pubspec.yaml. Always reference a release
tag rather than a branch:
dependencies:
klp_flutter_sdk:
git:
url: https://github.com/kaizen-dev-team/klp-flutter-sdk.git
ref: v1.0.0Version pinning
Pinning to a tag such asv1.0.0ensures reproducible builds across
developers and CI environments. When you are ready to adopt a newer release,
updaterefto the new tag and run your regression tests before deploying.
Step 2 — Configure repository access
The SDK repository is private. A fine-grained personal access token is
provided to your organization during onboarding. Configure it on each developer
machine and CI environment before running flutter pub get.
The token must never be committed to source control, pubspec.yaml, or build
logs. Store it in your organization's secret manager for CI pipelines.
Local development
export GITHUB_TOKEN=your_token_here
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"Replace your_token_here with the token supplied by your account team. Keep the
HTTPS URL in pubspec.yaml from Step 1.
CI pipelines
Add GITHUB_TOKEN as a pipeline secret and run the same git config command at
the start of each job, before flutter pub get.
Step 3 — Resolve dependencies
From your application project root:
flutter pub getThis command fetches the SDK at the pinned tag, registers the Flutter plugin,
and resolves Dart dependencies. Native libraries are included in the repository —
no separate download step is required.
iOS note
Dependency resolution alone does not link the iOS native framework. Complete
Step 5 — iOS setup after this step.
Step 4 — Verify platform requirements
Confirm your application targets meet the SDK minimums:
| Platform | Configuration | Required value |
|---|---|---|
| iOS | ios/Podfile → platform :ios | '13.0' |
| Android | android/app/build.gradle → minSdk | 24 |
Step 5 — iOS setup
Install CocoaPods dependencies after flutter pub get:
cd ios && pod install && cd ..The SDK plugin includes the required native iOS framework. You do not need to add
a separate entry to your application's Podfile.
When building from Xcode, open Runner.xcworkspace, not Runner.xcodeproj.
Step 6 — Android setup
No additional Gradle configuration is required. The SDK links the Android native
library through Flutter's standard plugin autolinking.
Step 7 — Verify the installation
Add a minimal initialization call to confirm the plugin is linked correctly:
import 'package:flutter/foundation.dart';
import 'package:klp_flutter_sdk/klp_flutter_sdk.dart';
Future<void> bootstrapKlp() async {
await Klp.instance.initialize(
KlpInitializeConfig(
environment: kReleaseMode ? KlpEnvironment.prod : KlpEnvironment.test,
debugMode: !kReleaseMode,
showDebugScreen: false,
),
);
}Invoke this once after WidgetsFlutterBinding.ensureInitialized() in your
application entry point. See Usage page for the complete integration
lifecycle.
Continuous integration
Configure your CI pipeline to authenticate before dependency resolution:
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
flutter pub get
cd ios && pod install && cd ..Troubleshooting
| Symptom | Cause | Resolution |
|---|---|---|
Git error or 404 during pub get | Missing or expired token | Verify GITHUB_TOKEN is set; contact your account team for a new token |
MissingPluginException | Stale build artifacts | Run flutter clean, flutter pub get, then pod install |
| iOS link error for the SDK | Outdated CocoaPods integration | Run pod deintegrate && pod install in ios/; open .xcworkspace |
| Android build error for the SDK | Incomplete dependency resolution | Run flutter clean and flutter pub get; contact support if the issue persists |
KlpNotInitializedException | SDK method called before initialization | Ensure initialize() completes before any other SDK call |
KlpSecurityException on a physical device | Device failed integrity verification | Test on a standard, non-modified device |
KLP_LAUNCH_ERROR | No active view controller or Activity | Call launch() from a visible screen after the first frame; confirm the user session is established |
Security recommendations
- Store the token in a secret manager — never in source code
- Pin
refto an immutable release tag - Set
debugMode: falseandshowDebugScreen: falsein production builds - Build release artifacts with
--obfuscate --split-debug-info
Updated 29 days ago
