get_upi 0.0.2
get_upi: ^0.0.2 copied to clipboard
Flutter plugin for get the installed upi apps on device and launch the application.
example/lib/main.dart
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:get_upi/get_upi.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
List<UpiObject> upiAppsList = [];
@override
void initState() {
getUpi();
super.initState();
}
void getUpi() async {
var value = await GetUPI.apps();
upiAppsList = value.data;
setState(() {});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: InkWell(
onTap: () {
log(upiAppsList[0].packageName);
GetUPI.launch(
package: upiAppsList[0].packageName,
url: "",
);
},
child: Center(
child: Column(
children: [
Image.memory(base64Decode(upiAppsList[0].icon)),
Text(upiAppsList[0].name),
Text(upiAppsList[0].packageName),
],
),
),
),
),
);
}
}