flutter_pluggy_connect 3.0.1 flutter_pluggy_connect: ^3.0.1 copied to clipboard
Pluggy Connect SDK for Flutter.
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_pluggy_connect/flutter_pluggy_connect.dart';
class HomePageState extends State<HomePage> {
bool _showPluggyConnect = false;
void _togglePluggyConnect() {
setState(() {
_showPluggyConnect = !_showPluggyConnect;
});
}
@override
Widget build(BuildContext context) {
return PluggyConnect(
includeSandbox: true,
onSuccess: (data) {
print('Success');
print(jsonEncode(data));
},
onClose: () {
print('Closed');
_togglePluggyConnect();
},
onError: (error) {
print('Error');
print(jsonEncode(error));
},
onOpen: () {
print('Opened');
},
onEvent: (payload) {
print('Event');
print(jsonEncode(payload));
},
connectToken: '<YOUR_CONNECT_TOKEN>',
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
HomePageState createState() => HomePageState();
}
void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(backgroundColor: Colors.black, toolbarHeight: 1),
body: const HomePage())),
);
}