flutter_yandex_games 0.0.1 copy "flutter_yandex_games: ^0.0.1" to clipboard
flutter_yandex_games: ^0.0.1 copied to clipboard

Flutter Web plugin for Yandex Games Sdk.

Flutter Web plugin for Yandex Games Sdk.

Features #

Player data save/load. Show Fullscreen Ad. Show Rewarded Ad.

Getting started #

Installation #

Add this to your index.html

<script src="https://yandex.ru/games/sdk/v2"></script>
dependencies:
  ...
  flutter_yandex_games: 0.0.1

If you get 404 error for js files in your game after uploading to Yandex, remove

<base href="$FLUTTER_BASE_HREF">

from your index.html

Usage #

Init Sdk #

await YandexGames.init();

Get Player Data #

var player = YandexGames.getPlayer();
var data = player.getData()

Set Player Data #

var player = YandexGames.getPlayer();
player.setData({"gold": 100});

Show Fullscreen Ad #

YandexGames.showFullscreenAd()

Show Rewarded Video Ad #

YandexGames.showRewardedVideoAd(
  onOpen: (){
    debugPrint("rewardedVideo onOpen");
  },
  onRewarded: (){
    //Give reward
  },
  onClose: (){
    debugPrint("rewardedVideo onClosed");
  },
  onError: (){
    //Show error
  },
);