ordersune_crm_flutter_sdk 0.0.4
ordersune_crm_flutter_sdk: ^0.0.4 copied to clipboard
A Flutter-ready CRM tool to manage notifications, in-app messages, email campaigns.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:ordersune_crm_flutter_sdk/ordersune_crm_flutter_sdk.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'CRM Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: CRMHomePage(),
);
}
}
class CRMHomePage extends StatefulWidget {
@override
_CRMHomePageState createState() => _CRMHomePageState();
}
class _CRMHomePageState extends State<CRMHomePage> {
late CRM crm;
@override
void initState() {
super.initState();
// Initialize the CRM instance
crm = CRM(
apiKey: 'your_api_key',
endpoint: 'https://your-api-endpoint.com',
pushToken: 'your_push_token',
debug: true,
);
// Example CRM usage
initializeCRM();
}
Future<void> initializeCRM() async {
await crm.initialize();
// Identify a user
crm.identify('user_12345');
// Track an event
crm.trackEvent('button_clicked', 'interaction', properties: {
'buttonName': 'Submit',
});
// Track a custom attribute
crm.trackCustomAttributes('favorite_color', 'blue');
// Log a purchase
crm.logProductPurchase(
'123456',
'123',
'Product Name',
49.99,
1,
'mobile',
'delivery',
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('CRM Demo'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
// Track another event when button is clicked
crm.trackEvent('demo_button_pressed', 'interaction', properties: {
'time': DateTime.now().toString(),
});
},
child: Text('Press Me'),
),
),
);
}
}