play_game_service 0.2.5 play_game_service: ^0.2.5 copied to clipboard
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 #
-
add dependencies
dependencies: play_game_service: ^0.2.2
-
import requirements
import 'package:play_game_service/play_game_service.dart';
-
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 } }
-
Save Game Data
var ret = await PlayGameService.saveSnapShot("HashiTogether", new Uint8List(10), "description"); if(ret.success){ // save successful }
-
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. } }
-
Show Leaderboards
PlayGameService.showLeaderboards();
-
Submit score
// leaderBoardId is the leaderboard's id which you added in google play console PlayGameService.submitScore(leaderBoardId, count);
-
Show Achievement
PlayGameService.showAchievements();
-
Achievement increment
// ACHIEVEMENT_ID is the achievement's id which you added in google play console PlayGameService.increment(ACHIEVEMENT_ID);