Installation
Supported Platforms
The library is available for the following Flutter 3.44.0+ and Dart 3.12.0+ platforms:
- Android 6.0 (API 23) and newer
- iOS 13.4 and newer
How To Install
1. Prerequisites
- Flutter SDK installed (Get Started)
- A working Flutter project (
flutter create my_appif starting fresh)
2. Add Dependency
Add the package from pub.dev:
flutter pub add flutter_powerauth_mobile_sdk_plugin
3. Configure Native Platforms
Android
Set the minimum SDK version to 23 and enable Java 17. New Flutter projects use Kotlin DSL in android/app/build.gradle.kts:
android {
defaultConfig {
minSdk = 23
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
For a project that still uses Groovy in android/app/build.gradle, use:
android {
defaultConfig {
minSdkVersion 23
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
iOS
The plugin supports both Swift Package Manager (SwiftPM) and CocoaPods. The Dart dependency added in step 2 is the same for either option.
Swift Package Manager
Flutter 3.44 and newer enable SwiftPM by default. To install the plugin in an iOS app:
- Open
ios/Runner.xcworkspacein Xcode. Select theRunnertarget and set Minimum Deployments to iOS 13.4 or newer. - If you changed the deployment target, regenerate the iOS configuration with
flutter build ios --config-only. - Run the app with
flutter runon an iOS simulator or device. Flutter addsFlutterGeneratedPluginSwiftPackageto the Xcode project and resolves the plugin’s nativePowerAuth2dependency through SwiftPM.
You can check the integration in Xcode under Package Dependencies: FlutterGeneratedPluginSwiftPackage should be present. Flutter manages the plugin and its native dependencies, so there is no need to add this repository or PowerAuth2 as a separate Xcode package.
If SwiftPM was previously disabled, run flutter config --enable-swift-package-manager and remove any enable-swift-package-manager: false setting from the flutter.config section of your app’s pubspec.yaml. Flutter may still use CocoaPods for other plugins that do not support SwiftPM. See Flutter’s SwiftPM guide for details.
CocoaPods
If your project uses CocoaPods, ensure the platform version in ios/Podfile is at least 13.4:
platform :ios, '13.4'
Then install pods:
cd ios
pod install
cd ..
If the application uses Face ID for biometric authentication, add a user-facing usage description to ios/Runner/Info.plist:
<key>NSFaceIDUsageDescription</key>
<string>Use Face ID to authenticate.</string>
Replace the example text with a description appropriate for your application. iOS requires this key before an application can access Face ID.
4. Initialize PowerAuth in Dart
In your main Dart file or wherever needed:
import 'package:flutter_powerauth_mobile_sdk_plugin/flutter_powerauth_mobile_sdk_plugin.dart';
final powerAuth = PowerAuth("my-instance-id");