upi_intent_mandate 0.0.4 copy "upi_intent_mandate: ^0.0.4" to clipboard
upi_intent_mandate: ^0.0.4 copied to clipboard

Flutter plugin for get the installed upi apps on device and launch the application.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:upi_intent_mandate/upi_intent_mandate.dart';

void main() {
  runApp(
    MaterialApp(
      theme: ThemeData(useMaterial3: true),
      home: const MyApp(),
    ),
  );
}

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

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

class _MyAppState extends State<MyApp> {
  List upiAppsList = [];
  List<UpiObject> upiAppsListAndroid = [];

  @override
  void initState() {
    super.initState();
  }

  Future<void> getUpi() async {
    if (Platform.isAndroid) {
      var value = await GetUPI.apps();
      upiAppsListAndroid = value.data;
    } else if (Platform.isIOS) {
      var valueIos = await GetUPI.iosApps();
      upiAppsList.clear();
      upiAppsList = valueIos;
    }

    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            CircleAvatar(
              backgroundColor: const Color(0xffDCE0E6),
              radius: 20,
              child: Image.asset(
                "lib/src/assets/icons/gpay.png",
                package: "upi_intent_mandate",
                width: 40,
                height: 40,
                fit: BoxFit.fill,
              ),
            ),
            ElevatedButton(
              onPressed: () {
                if (Platform.isAndroid) {
                  GetUPI.openNativeIntent(
                    url: 'your mandate url',
                  );
                } else if (Platform.isIOS) {
                  getUpi().then((_) {
                    GetUPI().showUpiSheet(
                      context,
                      upiAppsList: upiAppsList,
                      mandateUrl: "your mandate url",
                    );
                  });
                }
              },
              child: const Text("Native Intent"),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
130
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for get the installed upi apps on device and launch the application.

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on upi_intent_mandate

Packages that implement upi_intent_mandate