finclipsdk 0.3.0 finclipsdk: ^0.3.0 copied to clipboard
FinClip Desktop plugin SDK
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:finclipsdk/finclipsdk.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
String _title = "Plugin example app";
final _finclipsdkPlugin = Finclipsdk();
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion =
await _finclipsdkPlugin.getPlatformVersion() ?? 'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
await _finclipsdkPlugin.initialize('22LyZEib0gLTQdU3MUauAVUHSFDdTToYDWCqr0AgPGwA','8c5c3c26420b7e66','https://api.finclip.com','C:\\Users\\Administrator\\source\\repos\\finclipsdk\\windows\\vendor\\finclipsdk\\windows\\x86_64\\FinClip\\FinClip.exe','1') ;
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Running on: $_platformVersion\n'),
),
body: Center(
child:
TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(Colors.blue),
),
onPressed: () async {
await _finclipsdkPlugin.startApplet("1","6369e01175ddf4000123f6bc");
},
child: Text('打开小程序'),
),
),
),
);
}
}