cobuy_sdk 3.0.1
cobuy_sdk: ^3.0.1 copied to clipboard
CoBuy Flutter SDK enables group-based purchasing where multiple users can join a group to buy products together. Once the required number of members joins, the group is completed and users receive dis [...]
example/lib/main.dart
import 'package:cobuy_sdk/cobuy_sdk.dart';
import 'package:cobuy_sdk_example/product/view/product_list_route.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
/// Initialize the CoBuy SDK
/// - Provide merchant key
/// - Set SDK environment (staging/production)
await CoBuySdk.initialize(
merchantKey: 'cobuy_test_ABC123XYZ890',
sdkEnvironment: SdkEnvironment.production,
);
runApp(const MyHome());
}
class MyHome extends StatefulWidget {
const MyHome({super.key});
@override
State<MyHome> createState() => _MyHomeState();
}
class _MyHomeState extends State<MyHome> {
@override
void dispose() {
/// Dispose SDK resources on app exit
CoBuySdk.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
/// Use SDK navigator key to allow widgets inside SDK to show dialogs/snackbars
navigatorKey: CoBuySdk.navigatorKey,
/// Initial home screen of your app
home: const ProductListScreen(),
);
}
}