MyChips Flutter SDK Package

Description

MyChips Flutter SDK package

Usage

Initializing the sdk

You must initialize the sdk using your api key before using it.

await MCOfferwallSdk.instance.init(yourApiKey);

Setting user id

Optionally you can set the user id.
If you do not provide an user id, the sdk will automatically generate one.
If an user id is set (either manually or automatically) it will be used as long as a new user id is not provided manually.
To manually provide an user id:

await MCOfferwallSdk.instance.setUserId(userId); 

Checking for a reward

To check for a reward use the checkReward function. It requires your adunitId, a reward callback(which will be called if the checks shows that there is a reward), and an on error callback:

MCOfferwallSdk.instance.checkReward(
    adUnitId: yourAdUnitId,
    onReward: (reward) {
        //do something with the reward, here we just print it out
        print("Reward: $reward");
    },
    onError: (e, st) {
        //do something on error, here we just print it out
        print("Error: $e");
        print("Stacktrace: $st");
    });

Showing the offerwall

To show the offerwall we provide you with a widget called OfferwallPage. You should show it as a page using your preferred navigation package/method.

Example using the default flutter navigator:

Navigator.of(context).push(
    MaterialPageRoute(
        builder: (context) => OfferwallPage(
        adunitId: yourAdUnitId,
        ),
    ),
);