Flutter integration

Adding Saakuru Mobile Wallet SDK to your Flutter project

Step 1: Adding Saakuru Mobile Wallet SDK to your Flutter project

Android

To begin integrating the Saakuru Mobile SDK into your Flutter Android application, you need to add the SDK package as a dependency in your project. The SDK package is hosted on Pub, making it easy to include in your app using Gradle and pubspec dependencies:

Add the following config to your "local.properties" file inside the Android directory:

walletsdk.maven.url=given-by-saakuru  
walletsdk.maven.username=given-by-saakuru  
walletsdk.maven.password=given-by-saakuru

// Add the following code to your build.gradle file:

url properties.getProperty('walletsdk.maven.url')
credentials {
   username = properties.getProperty('walletsdk.maven.username')
   password = properties.getProperty('walletsdk.maven.password')
}

iOS

To begin integrating the Saakuru Mobile SDK into your Flutter iOS application, you need to add the SDK dependencies to your project. The SDK package is hosted on Cocoapods, making it easy to include in your app using your project’s podfile:

use_frameworks!  
pod "CYBAVOWallet", :git => '<https://github.com/AAG-Ventures/wallet-fork.git'`>

Add the following code to your pubspec.yaml dependencies:

metaone_wallet_sdk: ^{version} (latest ver. 1.8.8)

Step 2: Initializing SDK

Import metaone_wallet_sdk to your dart file:

import 'package:metaone_wallet_sdk/metaone_wallet_sdk.dart';

Map SDK config values:

const \_sdkConfig = MetaoneConfig(  
  realm: given-by-aag,  
  environment: test (test(testnet), stage(mainnet), prod(mainnet)),  
  clientReference: given-by-aag,  
  url: your personal SDK configuration json url,  
  key: Platform.isAndroid ? given-by-aag : given-by-aag,  
  sdkApiKeyPhrase: given-by-aag,    
  version: your-app-version,  
);

Initialize MetaOne SDK:

await initialize(sdkConfig);

Step 3: Creating a User Session

To successfully initialize a user session, your back-end integration has to be ready first. Your backend should receive an Authorization token during the initialization request.

Initialize the session by calling: logInWithSSO(token);

Your session is initialized. You can now use all other functions that require Authorization

Call setupUserData(); to initialize user profile data

Demo app project https://github.com/AAG-Ventures/flutter-sdk-demo

Important:

To ensure a good user experience, we recommend you implement:

  1. Initialize user session during initial auth

  2. Refresh the user session when the session expires.

Last updated