coretava_flutter 1.0.5 copy "coretava_flutter: ^1.0.5" to clipboard
coretava_flutter: ^1.0.5 copied to clipboard

Coretava Core Loyalty is a Flutter package for integrating loyalty programs, managing points, transactions, and user rewards with seamless API communication.

example/lib/main.dart

import 'package:coretava_flutter/coretava_flutter.dart';
import 'package:flutter/material.dart';

class SampleAppCartDelegate extends CartDelegate {
  final CartData _cartData = CartData(
      id: 'sample-id', total: 1200, itemsTotal: 1000, discountCodes: []);

  @override
  Future<void> onApplyDiscount(String code) async {
    // Here you need to add the apply discount code logic
    _cartData.discountCodes.add(code);
  }

  @override
  Future<CartData> onRetrieveData() async {
    // Here you need to return the cart information
    return _cartData;
  }
}

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize Coretava Core Loyalty
  await coreLoyalty.initialize(
      appId: 'YOUR_APP_ID',
      user: User(
          externalId: "USER_EXTERNALID",
          email: "USER_EMAIL",
          firstName: "USER_FIRST_NAME",
          lastName: "USER_LAST_NAME",
          hash: "USER_HASH"),
      cartDelegate: SampleAppCartDelegate());

  runApp(SampleApp());
}

class SampleApp extends StatelessWidget {
  const SampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Sample app',
        // Inject CoreLoyaltyApp to the Flutter app
        home: CoreLoyaltyApp(
          child: Center(),
        ));
  }
}
2
likes
50
points
61
downloads

Publisher

verified publishercoretava.com

Weekly Downloads

Coretava Core Loyalty is a Flutter package for integrating loyalty programs, managing points, transactions, and user rewards with seamless API communication.

Homepage

License

MIT (license)

Dependencies

built_collection, built_value, coretava_core_apis, coretava_ecommerce_apis, coretava_events_apis, dio, flutter, flutter_localizations, flutter_mobx, flutter_svg, intl, mobx, mobx_codegen, provider, url_launcher

More

Packages that depend on coretava_flutter