GamesServices class
A helper class that contains all of the library's functions. This is a support class for apps that use pre-3.0 versions of the library. Please consider using GameAuth for authentication, Achievements for anything related to Achievements, Leaderboards for anything related to Leaderboards, Player for anything related to Player, and SaveGame for anything related to game saves.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
isSignedIn
→ Future<
bool> -
Check to see if the user is currently signed into Game Center or Google Play Games.
no setter
-
player
→ Stream<
PlayerData?> -
Stream of the currently authenticated player. If not null, the player
is signed in & games_services functionality is available.
no setter
-
playerIsMultiplayerGamingRestricted
→ Future<
bool?> -
Check if the current player is restricted from joining multiplayer games (always false on Android).
no setter
-
playerIsPersonalizedCommunicationRestricted
→ Future<
bool?> -
Check if the current player is restricted from using personalized communication on
the device (always false on Android).
no setter
-
playerIsUnderage
→ Future<
bool?> -
Check if the current player is underage (always false on Android).
no setter
Static Methods
-
deleteGame(
{required String name}) → Future< String?> -
Delete game with
name. -
getAuthCode(
String clientID) → Future< String?> -
Retrieve a Google Play Games
server_auth_codeto be used by a backend, such as Firebase, to authenticate the user.nullon other platforms. -
getPlayerHiResImage(
) → Future< String?> - Get the player's hi-res profile image as a base64 encoded String.
-
getPlayerIconImage(
) → Future< String?> - Get the player's icon-size profile image as a base64 encoded String.
-
getPlayerID(
) → Future< String?> - Get the current player's ID. On iOS/macOS the player ID is unique for your game but not other games.
-
getPlayerName(
) → Future< String?> - Get the current player's name. On iOS/macOS the player's alias is provided.
-
getPlayerScore(
{dynamic iOSLeaderboardID = "", dynamic androidLeaderboardID = ""}) → Future< int?> - Get the current player's score for a specific leaderboard.
-
getSavedGames(
{bool forceRefresh = false}) → Future< List< SavedGame> ?> - Get all saved games.
-
hideAccessPoint(
) → Future< String?> - Hide the Game Center Access Point.
-
increment(
{required Achievement achievement}) → Future< String?> -
Increment an
achievement. Achievement takes two parameters:androidIDthe achievement ID for Google Play Games.stepsIf the achievement is of the incremental type you can use this method to increment the steps. -
loadAchievements(
{bool forceRefresh = false}) → Future< List< AchievementItemData> ?> - Get achievements as a list. Use this to build a custom UI. To show the device's default achievements screen use showAchievements.
-
loadGame(
{required String name}) → Future< String?> -
Load game with
name. -
loadLeaderboardScores(
{dynamic iOSLeaderboardID = "", dynamic androidLeaderboardID = "", bool playerCentered = false, required PlayerScope scope, required TimeScope timeScope, bool forceRefresh = false, required int maxResults}) → Future< List< LeaderboardScoreData> ?> - Get leaderboard scores as a list. Use this to build a custom UI. To show the device's default leaderboards screen use showLeaderboards.
-
resetAchievements(
) → Future< String?> - It will reset the achievements.
-
saveGame(
{required String data, required String name}) → Future< String?> -
Save game with
dataand a uniquename. Thenamemust be between 1 and 100 non-URL-reserved characters (a-z, A-Z, 0-9, or the symbols "-", ".", "_", or "~"). -
showAccessPoint(
AccessPointLocation location) → Future< String?> - Show the Game Center Access Point for the current player.
-
showAchievements(
) → Future< String?> - Open the device's default achievements screen.
-
showLeaderboards(
{dynamic iOSLeaderboardID = "", dynamic androidLeaderboardID = ""}) → Future< String?> - Open the device's default leaderboards screen. If a leaderboard ID is provided, it will display the specific leaderboard, otherwise it will show the list of all leaderboards.
-
signIn(
) → Future< String?> - Sign the user into Game Center or Google Play Games. This must be called before taking any action (such as submitting a score or unlocking an achievement).
-
submitScore(
{required Score score}) → Future< String?> -
Submit a
scoreto specific leaderboard. Score takes three parameters:androidLeaderboardIDthe leaderboard ID for Google Play Games.iOSLeaderboardIDthe leaderboard ID for Game Center.valuethe score. -
unlock(
{required Achievement achievement}) → Future< String?> -
Unlock an
achievement. Achievement takes three parameters:androidIDthe achievement ID for Google Play Games.iOSIDthe achievement ID for Game Center.percentCompletethe completion percentage of the achievement, this parameter is optional on iOS/macOS.showsCompletionBannerfor iOS only, defaults to true