wk_plugin 1.0.0
wk_plugin: ^1.0.0 copied to clipboard
A new Flutter wk_plugin project.
example/lib/main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:wk_plugin/wk_plugin.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
// Platform messages are asynchronous, so we initialize in an async metho
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(children: [
TextButton(
onPressed: () async {
var code = await WkPlugin.instance.init(appID: 123456);
if (kDebugMode) {
print('$code');
}
},
child: const Text('初始化',
style: TextStyle(fontSize: 20, color: Colors.orange))),
TextButton(
onPressed: () {
WkPlugin.instance.unInit();
},
child: const Text('反初始化',
style: TextStyle(fontSize: 20, color: Colors.orange))),
]),
),
),
);
}
}