iNuba App logo

iNuba App SDK


iNuba app integration as SDK for Flutter mobile applications

Website   •   Download app   •   Contact us

The iNuba App SDK for Flutter 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 obtain your iNuba SDK access credentials, please 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: ^1.1.1

Then run:

flutter pub get

Quick Start

Basic Usage

Import the package in your project:

import 'package:inuba_flutter_sdk/inuba_flutter_sdk.dart';

Basic Configuration

Basic configuration with required parameters:

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 unit measurement
  unitMeasurement: UnitMeasurement.metric,

  // Optional: Handle file downloads from WebView (Highly recommended to implement)
  onDownload: (url, filename, downloadAndShare) {
    // Handle file download from WebView
    // Use flutter_downloader, flutter_file_downloader packages or your own implementation
  },

  // Optional: Handle SDK close events (It only works if displayMode is DisplayMode.fullScreen)
  onClose: (reason) {
    // Custom close behavior (defaults to Navigator.pop)
    // Use your own navigation system
  },
)

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
  • Platform.ios: iOS platform

Display Mode

  • DisplayMode.fullScreen: Full screen presentation (default)
  • DisplayMode.inlineView: Inline view presentation

Language

  • Language.userChoice: Let the user choose their preferred language in the app (default)
  • Language.en: English language
  • Language.es: Spanish language

Unit Measurement

  • UnitMeasurement.userChoice: Let the user choose their preferred unit system in the app (default)
  • UnitMeasurement.metric: Metric system (kg, cm)
  • UnitMeasurement.imperial: Imperial system (lb, in)

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>

And add the internet permission outside the <application> tag:

<uses-permission android:name="android.permission.INTERNET" />

Testing and Development

Physical Devices

It is highly recommended to test and run this SDK on physical devices rather than emulators. In our extensive testing, we have encountered multiple errors and issues on emulators that are completely resolved when using physical devices. Android and iOS emulators may exhibit WebView rendering problems, performance issues, and other unexpected behaviors that don't occur on real hardware.

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