algo360pfm 0.0.7 algo360pfm: ^0.0.7 copied to clipboard
Algo360 SDK extracts transactional SMS from the user’s device and provides an expense tracking dashboard which helps get an accurate picture of overall expenses in a single view.
import 'dart:async';
import 'dart:developer';
import 'package:algo360pfm/algo360pfm.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _algo360pfmPlugin = Algo360pfm();
@override
void initState() {
super.initState();
setConfiguration();
setTheme();
}
Future<void> setConfiguration() async {
String? platformVersion;
try {
_algo360pfmPlugin.setConfiguration("", "", "", "");
} on PlatformException {
platformVersion = 'Failed to set permissions';
}
if (!mounted) return;
}
Future<void> startPFM() async {
try {
_algo360pfmPlugin.invokePFM();
} on PlatformException {
log("exception");
}
if (!mounted) return;
}
Future<void> invokeSDK() async {
try {
_algo360pfmPlugin.invokeSDK(1);
} on PlatformException {
log("exception");
}
if (!mounted) return;
}
Future<void> setTheme() async {
try {
_algo360pfmPlugin.setTheme("LIGHT");
} on PlatformException {
log("exception");
}
if (!mounted) return;
}
Future<void> invokePermissionsScreen() async {
try {
_algo360pfmPlugin.invokePermissionsScreen();
} on PlatformException {
log("exception");
}
if (!mounted) return;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Set Configuration"),
MaterialButton(
onPressed: () {
setConfiguration();
},
color: Colors.blueAccent,
child: const Text("Launch"),
),
const Text("PFM"),
MaterialButton(
onPressed: () {
startPFM();
},
color: Colors.blueAccent,
child: const Text("Launch"),
),
const Text("SDK"),
MaterialButton(
onPressed: () {
invokeSDK();
},
color: Colors.blueAccent,
child: const Text("Launch"),
),
const Text("Permission Screen"),
MaterialButton(
onPressed: () {
invokePermissionsScreen();
},
color: Colors.blueAccent,
child: const Text("Launch"),
)
],
),
)),
);
}
}