iNuba Flutter SDK
The iNuba Flutter SDK allows you to integrate iNuba services seamlessly into your Flutter application with type-safe configuration and bidirectional communication.
The package uses the flutter_inappwebview plugin to provide a robust WebView experience with bidirectional communication between Flutter and JavaScript.
To get your credentials, contact the iNuba development team.
Installation
Add the iNuba Flutter SDK to your project by including it in your pubspec.yaml file:
dependencies:
inuba_flutter_sdk: ^0.6.0
Then run:
flutter pub get
Quick Start
Basic Usage
Import the package in your project:
import 'package:inuba_flutter_sdk/inuba_flutter_sdk.dart';
Minimal integration:
INubaSDK(
clientToken: 'your_client_token',
userToken: 'your_user_token',
)
Advanced Configuration
Full configuration with all available options:
INubaSDK(
clientToken: 'your_client_token',
userToken: 'your_user_token',
// Optional white label
whitelabel: Whitelabel.iNuba,
// Optional environment
environment: Environment.production,
// Optional platform identification
platform: Platform.android,
// Optional display mode
displayMode: DisplayMode.fullScreen,
// Optional language
language: Language.en,
// Optional callbacks
onDownload: (url, filename, downloadAndShare) {
// Handle file download from WebView
print('Download requested: $filename from $url');
},
onClose: (reason) {
// Custom close behavior (defaults to Navigator.pop)
print('SDK closed: $reason');
Navigator.of(context).pop();
},
)
Configuration Options
Whitelabel
- Whitelabel.iNuba: Default iNuba branding (default)
- Whitelabel.custom('YourBrand'): Custom branding (Contact iNuba to get your own branding)
Environment
- Environment.develop: Development environment (default)
- Environment.production: Production environment
Platform
- Platform.android: Android platform (default)
- Platform.ios: iOS platform
Display Mode
- DisplayMode.fullScreen: Full screen presentation (default)
- DisplayMode.inlineView: Inline view presentation
Language
- Language.en: English language (default)
- Language.es: Spanish language
Event Callbacks
Download Event
Handle file downloads initiated from the WebView:
onDownload: (String url, String filename, bool downloadAndShare) {
// url: File URL to download
// filename: Suggested filename
// downloadAndShare: Whether to share after download
// Implement your download logic here
}
Close Event
Handle SDK close requests from the WebView:
onClose: (String reason) {
// reason: Close reason from WebView (default: 'unknown')
// Custom close logic
}
Note: If onClose is not provided, the SDK automatically calls Navigator.pop(context).
Android Configuration
Add this provider configuration to your android/app/src/main/AndroidManifest.xml inside the <application> tag:
<provider
android:name="com.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFileProvider"
android:authorities="${applicationId}.flutter_inappwebview_android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
Testing and Development
Best Practices
For the best development and testing experience:
-
Use Physical Devices: While the SDK works on emulators, testing on physical devices is highly recommended for accurate performance evaluation. Android emulators may exhibit WebView rendering issues that don't occur on real devices.
-
Enable Hardware Acceleration: Ensure hardware acceleration is enabled on your test devices for optimal WebView performance.
-
Check Network Connectivity: The SDK requires active internet connection to communicate with iNuba services.
Example Application
A complete example application is available in the example/ directory. To run it:
cd example
flutter run
See example/README.md for detailed integration instructions and best practices.
Support
For questions or issues, please contact the iNuba development team.
License
MIT License - see the LICENSE file for details.
Libraries
- inuba_flutter_sdk
- iNuba Flutter SDK