mm_flutter_foo_yeepal_wallet_sdk 0.0.3 copy "mm_flutter_foo_yeepal_wallet_sdk: ^0.0.3" to clipboard
mm_flutter_foo_yeepal_wallet_sdk: ^0.0.3 copied to clipboard

Flutter plugin for Foo Yeepal Wallet SDK

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:mm_flutter_foo_yeepal_wallet_sdk/foo_yeepal_wallet.dart';
import 'package:mm_flutter_foo_yeepal_wallet_sdk/wallet_sdk_app_configuration.dart';
import 'package:mm_flutter_foo_yeepal_wallet_sdk/wallet_sdk_features_configuration.dart';
import 'package:mm_flutter_foo_yeepal_wallet_sdk/wallet_sdk_network_configuration.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  initState() {
    super.initState();
    startWalletSDK(); // Start the Wallet SDK when the app is initialized
  }

  // Combined function to setup and start the Wallet SDK
  Future<void> startWalletSDK() async {
    try {
      final networkConfiguration = WalletSDKNetworkConfiguration(
        baseUrl: "",
        idvUrl: "",
        pfmUrl: "",
        webFormsUrl: "",
        xapp: "",
        channelId: "",
        applicationId: "",
        hceUrl: "",
        authorizationToken: "",
      );

      // ADDITIONAL CONFIGURATIONS FOR IOS

      final featuresConfiguration = WalletSDKFeaturesConfiguration(
        paymentCardBackendImageVisibility: true,
        backendPreonboardingImagesVisibility: true,
      );

      final appConfiguration = WalletSDKAppConfiguration(
        countryRegion: "",
        defaultAmountLeftDigits: 9,
        defaultAmountDecimalDigits: 2,
        currencyCode: "",
        currencyLocalized: "",
        canEditCountryCode: true,
        phoneNumber: "",
        website: "",
        email: "",
        googleMapApiKey: "",
      );

      // Call the setup and start method from the Wallet SDK
      await FooYeepalWallet.startWalletSDK(
        networkConfiguration: networkConfiguration,
        featuresConfiguration: featuresConfiguration,
        appConfiguration: appConfiguration,
      );
      print(
          "Wallet SDK setup and started successfully."); // Log success message
    } on PlatformException catch (e) {
      // Handle any exceptions thrown during the setup or start
      print("Failed to setup or start Wallet SDK: '${e.message}'.");
    } catch (e) {
      // Catch any other exceptions and show an error message
      print("An unexpected error occurred: $e");
    }
  }

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(),
    );
  }
}
0
likes
135
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for Foo Yeepal Wallet SDK

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on mm_flutter_foo_yeepal_wallet_sdk

Packages that implement mm_flutter_foo_yeepal_wallet_sdk