tata_rewards 0.0.32 copy "tata_rewards: ^0.0.32" to clipboard
tata_rewards: ^0.0.32 copied to clipboard

tata rewards package

Tata Rewards #

Tata Rewards package lets you add a widget that supports stuffs to rewards to your Flutter app.

Installation #

  1. Add the latest version of package to your pubspec.yaml (and runflutter pub get):
dependencies:
  tata_rewards: ^0.0.32
  1. Import the package and use it in your Flutter App. flutter pub add tata_rewards

Example #

There are a number of properties that you can modify:

https://docs.google.com/spreadsheets/d/1XLEHj1LGox_S-whE9bJ5HoMCyNYrhE37eOzf-Ci0qXc/edit?usp=sharing ( but for this need to get verify from ESMAGICO)



import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:firebase_core/firebase_core.dart';
import 'package:tata_rewards/tata_rewards.dart';

import 'firebase_options.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  http.Client httpClient = http.Client();

  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

  // Initialize the SDK
  await MyRewardsSdk.instance.initialize(
    httpClient: httpClient,
    tdlBaseUrl: "https://gratify-rewards.esmagico.net",
    tplBaseUrl: "https://gratify-rewards.esmagico.net",
  );

  await MyRewardsSdk.instance.subscribeToActiveCardCount(
    userId: 'Ankush-12', // This will be the external customerId
    onCountChanged: (int? activeCount, ScratchCard? scratchCard) {
      if (activeCount != null) {
        // Handle the update, e.g., show a dialog or update UI
      }
    },
    onError: (String error) {
      // Handle the error, e.g., show a message to the user
    },
  );

  await MyRewardsSdk.instance.notifyLogin(
      tdlToken:
      "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImFhN2Y2YTMwLWY0NGYtNDgxMS1hZTUzLWZhNjRhZDkyOWIzNCIsImV4dGVybmFsQ3VzdG9tZXJJZCI6IjYwNzk1NDU0MjIiLCJvcmdfaWQiOiI3ZTEwNjE4Ny1jMmMxLTQ5YTMtODcyOC02ZDM3MzY2OTRiYWQiLCJvcmdhbmlzYXRpb25Db2RlIjoiVERMVEVTVCIsIm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uhQ");
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Gamification SDK',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.black38),
        useMaterial3: true,
      ),
      home: MyRewardsPage(
        title: "My Rewards",
        myRewardsPadding: 16,
        onScratchCardClick: (id, point, status) {},
        gap: const SizedBox(
          height: 20,
        ),
      ),
    );
  }
}






Tata Rewards

Next Goals #

  • đŸ•šī¸ Expand Games Portfolio Add new games alongside Scratch Cards, like Spin-the-Wheel, offering diverse gamified experiences.

  • 🧠 AI-Powered Trivia Introduce engaging trivia games powered by AI to elevate user interaction.

  • 🔍 Advanced Analytics Coming soon: Gain insights into user engagement and performance metrics with enhanced reporting tools.