algo360sdk 1.0.6
algo360sdk: ^1.0.6 copied to clipboard
Algo360 SDK extracts transactional SMS from the user’s device.
example/lib/main.dart
import 'dart:async';
import 'dart:developer' as dev;
import 'dart:math';
import 'package:algo360sdk/algo360pfm.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MaterialApp(
home: const MyApp(),
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: const Color(0xffebf8fa),
appBarTheme: const AppBarTheme(
color: Color(0xffebf8fa),
),
textSelectionTheme: const TextSelectionThemeData(
selectionColor: Colors.grey,
cursorColor: Color(0xffebf8fa),
selectionHandleColor: Color(0xffebf8fa),
),
inputDecorationTheme:
const InputDecorationTheme(focusColor: Color(0xffebf8fa)),
brightness: Brightness.light,
highlightColor: Colors.white,
colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.white),
),
));
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _algo360sdkPlugin = Algo360sdk();
final navigatorKey = GlobalKey<NavigatorState>();
@override
void initState() {
super.initState();
setConfiguration();
}
Future<void> setConfiguration() async {
try {
Random random = Random();
var rand = random.nextInt(99999999) + 9999;
await _algo360sdkPlugin.setConfiguration(
"",
"$rand",
"",
"",
true);
} on PlatformException {
dev.log("Platform Exception");
}
if (!mounted) return;
}
Future<void> invokeSDK() async {
try {
await _algo360sdkPlugin.invokeSDK();
} on PlatformException {
dev.log("exception");
}
}
Future<void> stopDataSync() async {
try {
await _algo360sdkPlugin.stopIncrementalDataSync();
} on PlatformException {
dev.log("exception");
}
}
Future<void> invokeIncrementalSDK() async {
try {
await _algo360sdkPlugin.invokeIncrementalSDK(1);
} on PlatformException {
dev.log("exception");
}
if (!mounted) return;
}
@override
Widget build(BuildContext context) {
return 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("SDK"),
MaterialButton(
onPressed: () {
invokeSDK();
},
color: Colors.blueAccent,
child: const Text("Launch"),
),
const Text("Incremental"),
MaterialButton(
onPressed: () {
invokeIncrementalSDK();
},
color: Colors.blueAccent,
child: const Text("Launch"),
),
const Text("Stop Data Sync"),
MaterialButton(
onPressed: () {
stopDataSync();
},
color: Colors.blueAccent,
child: const Text("Launch"),
),
],
),
),
);
}
}