konnect_wallet_services 0.0.7 konnect_wallet_services: ^0.0.7 copied to clipboard
Flutter web plugin to help intergrate wallet with super app
import 'package:flutter/material.dart';
import 'package:konnect_wallet_services/konnect_wallet_services%20copy.dart';
void main() {
WalletPlaformManager().init();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Web App',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with WithPlatformMessageRecieved {
@override
void initState() {
WalletPlaformManager.registerForService(this);
WalletPlaformManager.requestService(WalletPlatformService(
params: {'latest': 30},
walletService: WalletService.GET_PRINCIPAL));
// TODO: implement initState
super.initState();
}
var title = "Loggin in as ";
@override
void onPlatformResults(WalletPlatformService message) {
// TODO: implement onPlatformResults
super.onPlatformResults(message);
setState(() {
title = "Loggin in as ${message.params["firstName"]}";
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(children: [
Text("Welcome To Super App"),
Text("${title}")]),
);
}
}