dcoupon_sdk_flutter_package 10.0.0 copy "dcoupon_sdk_flutter_package: ^10.0.0" to clipboard
dcoupon_sdk_flutter_package: ^10.0.0 copied to clipboard

dcoupon sdk flutter package project. Support flutter applications to integrate dcoupon REST services.

dcoupon_sdk_flutter_package #

A Flutter package for dcoupon SDK. dcoupon SDK allows our clients to log in their users into the dcoupon service, so users can benefit from accessing dcoupon service from 3rd party apps, without needing to use an additional login for dcoupon.

Usage #

To use this plugin, add dcoupon_sdk_flutter_package as a dependency in your pubspec.yaml file.

MUST DO: Set up dcoupon SDK #

To start using dcoupon SDK methods, you need to provide contents of a json file to the SDK.

  1. Add a json file to your app with the following:
{
  "clientApiKey": "<YOUR_CLIENT_TOKEN_HERE>",
  "clientSecretKey": "<YOUR_CLIENT_SECRET_KEY_HERE>",
  "stage": "<YOUR_CLIENT_DOMAIN_HERE>",
}
  1. Read the json
var jsonString = await rootBundle.loadString("lib/assets/config/your_json_name.json");
  1. Initialize the SDK with the json config
    final jsonConfig = jsonDecode(jsonString);
    DcouponSDK.initializeSdk(
        options: DcouponSDKOptions(
      stage: jsonConfig['stage'],
      clientApiKey: jsonConfig['clientApiKey'],
      clientSecretKey: jsonConfig['clientSecretKey'],
    ));
  1. Call any SDK method

Example #

Future<void> login() async {
    // do login
    DcouponSDK.instance
        .logIn(
      externalId,
      referralCode: referralCode, //optional
    )
        .then((response) async {
      //User authenticated in dcoupon, you can call other methods
      DcouponListener response = await dcoupon.getCoupons(
                offset: int.parse(start),
                limit: int.parse(limit),
                sortBy: sortBy,
                companyTokens: companyTokens,
                retailerTokens: retailerTokens,
            )

    }).catchError((ex) {
      print("example.app.login.catchError: " + ex.toString());
    });
  }

API reference #

You can check the API reference in this page or go to dcoupon SDK API reference

1
likes
120
pub points
16%
popularity

Publisher

verified publisherdcoupon.com

dcoupon sdk flutter package project. Support flutter applications to integrate dcoupon REST services.

Homepage

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

collection, crypto, dartz, dio, equatable, flutter, flutter_localizations, get_it, intl, ntp, universal_io

More

Packages that depend on dcoupon_sdk_flutter_package