opatech_clearsale_flutter 2.0.0
opatech_clearsale_flutter: ^2.0.0 copied to clipboard
A flutter plugin to integrate clearsale behaviour android and ios.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:opatech_clearsale_flutter/opatech_clearsale_flutter.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String sessionId;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
await OpatechClearsaleFlutter.config(
"INSERIR O FINGERPRINT DA CLEARSELE"); // fingerprint id
sessionId = await OpatechClearsaleFlutter.sessionId;
} on PlatformException catch (e) {
sessionId = 'Failed. ${e.message}';
}
try {
await OpatechClearsaleFlutter.config(
"INSERIR O FINGERPRINT DA CLEARSELE"); // fingerprint id
sessionId += '\n' + await OpatechClearsaleFlutter.sessionId;
} on PlatformException catch (e) {
sessionId += '\n' + 'Failed. ${e.message}';
}
try {
await OpatechClearsaleFlutter.config(
"INSERIR O FINGERPRINT DA CLEARSELE"); // fingerprint id
sessionId += '\n' + await OpatechClearsaleFlutter.sessionId;
} on PlatformException catch (e) {
sessionId += '\n' + 'Failed. ${e.message}';
}
if (!mounted) return;
setState(() {
_platformVersion = sessionId;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Session Id: $_platformVersion\n'),
),
),
);
}
}