A Flutter plugin to support game center and google play games services.
Video tutorial Will be added soon.
Sign in the user to the Game center (iOS) or Google play games services (Android). You should call the sign in before making any action (like sending a score or unlocking an achievement).
Is Signed In
A boolean value to check to see if the user is currently signed into Game Center or Google Play Services.
To sign the user out of Goole Play Services. After calling, you can no longer make any actions on the user's account.
To show the achievements screen.
To show the leaderboards screen. It takes the leaderbord id for android and iOS.
GamesServices.showLeaderboards(iOSLeaderboardID: 'ios_leaderboard_id', androidLeaderboardID: 'android_leaderboard_id');
To submit a
Score to specific leaderboard.
Score class takes three parameters:
androidLeaderboardID: the leader board id that you want to send the score for in case of android.
iOSLeaderboardID the leader board id that you want to send the score for in case of iOS.
value the score.
GamesServices.submitScore(score: Score(androidLeaderboardID: 'android_leaderboard_id', iOSLeaderboardID: 'ios_leaderboard_id', value: 5));
To unlock an
Achievement takes three parameters:
androidID the achievement id for android.
iOSID the achievement id for iOS.
percentComplete the completion percent of the achievement, this parameter is optional in case of iOS.
steps the achievement steps for Android.
GamesServices.unlock(achievement: Achievement(androidID: 'android_id', iOSID: 'ios_id', percentComplete: 100, steps: 2));
Increment (Android Only)
To increment the steps for android achievement.
final result = await GamesServices.increment(achievement: Achievement(androidID: 'android_id', steps: 50)); print(result);
Show AccessPoint (iOS Only)
To show the access point you can call the following function:
This feature support only on the iOS, on Android there is nothing like this supported natively.
Hide AccessPoint (iOS Only)
To hide the access point.
To get the player you can call:
final playerID = GamesServices.getPlayerID();
To get the player name can call:
final playerID = GamesServices.getPlayerName();
Simply add the following line to your pubspec.yaml file:
dependencies: games_services: any # <-- Add this line
Support me 🚀
You can support this project by:
1- Checking my apps.
2- Star the repo.
3- Share the repo with your friends.