play_game_service 0.2.5 copy "play_game_service: ^0.2.5" to clipboard
play_game_service: ^0.2.5 copied to clipboard

PlatformAndroid

A Google Play Games Service Plugin, Created for my little game app. Only support Android for now, but nullsafe

play_game_service #

A Google Play Games Services plugin for flutter

Getting Started #

  1. add dependencies

    dependencies:
      play_game_service: ^0.2.2
    
  2. import requirements

    import 'package:play_game_service/play_game_service.dart';
    
  3. SignIn

    // set scopeSnapShot=false if you don't want play with snapshots;
    var ret = await PlayGameService.signIn(scopeSnapShot: true);
    if(ret.success){
      if(ret.email != null){
        // you can get user's email from ret.email
      }
    }
    
  4. Save Game Data

    var ret = await PlayGameService.saveSnapShot("HashiTogether", new Uint8List(10), "description");
    if(ret.success){
      // save successful
    }
    
  5. Load Game Data

    var ret = await PlayGameService.signIn(scopeSnapShot: true);
    if (ret.success) {
      var loadResult = await PlayGameService.loadSnapShot("HashiTogether");
      if (loadResult.success) {
        Uint8List data = loadResult.data!;
        // TODO Now you have data, do what you want.
      }
    }
    
  6. Show Leaderboards

    PlayGameService.showLeaderboards();
    
  7. Submit score

    // leaderBoardId is the leaderboard's id which you added in google play console
    PlayGameService.submitScore(leaderBoardId, count);
    
  8. Show Achievement

    PlayGameService.showAchievements();
    
  9. Achievement increment

    // ACHIEVEMENT_ID is the achievement's id which you added in google play console
    PlayGameService.increment(ACHIEVEMENT_ID);
    
2
likes
120
pub points
9%
popularity

Publisher

unverified uploader

A Google Play Games Service Plugin, Created for my little game app. Only support Android for now, but nullsafe

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on play_game_service