bharatx_flutter_common 1.0.6-release1
bharatx_flutter_common: ^1.0.6-release1 copied to clipboard

discontinued

Flutter wrapper for common from BharatX SDK

example/lib/main.dart

import 'package:bharatx_flutter_common/bharatx_flutter_common.dart';
import 'package:bharatx_flutter_securityhelpers/bharatx_flutter_securityhelpers.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  void confirmTransactionWithUser() async {
    try {
      await BharatXSecurityHelpers.storePartnerId("testPartnerId");
      await BharatXSecurityHelpers.storePartnerApiKey("testApiKey");
      BharatXCommonUtilManager.registerUserId("testUser2");
      CreditInfo creditInfo = await BharatXCommonUtilManager.userCreditInfo;
      print("Credit Info ${creditInfo.creditTaken}/${creditInfo.creditLimit}");
      BharatXCommonUtilManager.confirmTransactionWithUser(10000, () {
        print("User Confirmed Transaction");
        BharatXCommonUtilManager.registerTransactionId("transactionId", () {
          BharatXCommonUtilManager.showTransactionStatusDialog(true, () {
            print("Closed");
          });
        }, () {
          print("Failed to register transaction ID");
        });
      }, () {
        print("User Accepted Privacy Policy");
      }, () {
        print("User Cancelled Transaction");
      });
    } on PlatformException {
      print("Platform Exception");
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: TextButton(
            onPressed: confirmTransactionWithUser,
            child: Text("Click Here"),
          ),
        ),
      ),
    );
  }
}
0
likes
0
pub points
6%
popularity

Publisher

bharatx.tech

Flutter wrapper for common from BharatX SDK

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on bharatx_flutter_common