unified_game_services_platform_interface 0.2.1
unified_game_services_platform_interface: ^0.2.1 copied to clipboard
Shared platform interface for unified_game_services — models, events, capabilities and the base contract every provider implements (pure Dart).
Changelog #
0.2.1 #
- Add
PlayerProfile.avatarBytes(encoded image bytes, web-safeUint8List?) next toavatarUrl, andPlayerProfile.presence(RichPresence?). - Add
FriendPresenceChangedEvent: a snapshot of a friend whose online state, activity, name or avatar changed. - Breaking for exhaustive switches:
FriendPresenceChangedEventis a newGameServiceEventsubtype, so aswitchoverGameServiceEventwithout a wildcard must add a case.
0.2.0 #
- Add
UnifiedGameServicesPlatform.mappedStatIds: the native stat ids registered for a provider, for SDKs that cannot enumerate stats. - Ship an agent skill for implementing and testing custom providers against the 0.2.0 contract.
- Fix:
ProviderIdMap(googlePlay: ...)entries were never applied, because no provider reportsgoogle_play.UnifiedIdTable.forProvider/reverseForProvidernow fall back to thegoogle_playentry forgoogle_play_restandgoogle_play_android; a tier-specific entry still wins. - Breaking: removed the global platform instance (
UnifiedGameServicesPlatform.instance,getInstance,tryGetInstance) andUnsupportedUnifiedGameServices. The global now lives on theUnifiedGameServicesfacade. - Breaking:
UnifiedGameServicesPlatform.providerIdis now abstract: every provider must return a stablesnake_caseid (neverruntimeType).UnsupportedUnifiedGameServicesusesunsupported. Each implementation has its own id (e.g.google_play_rest/google_play_android). - Breaking:
GameCapability.multiplayerremoved in favor ofGameCapability.lobbiesandGameCapability.matchmaking. Achievement.nativeIds,Leaderboard.nativeIds,Stat.nativeKeys: read-onlyproviderId→ native id maps, set by the facade (nativeId/nativeKeygetters give the source provider's own);id/keyare the unified one.UnifiedIdTable.nativeIdsForandreverseForProviderexpose the table row and the native → unified inverse.- Behaviour change: the default bodies of every capability-gated method now
throw
CapabilityNotSupportedException(capability)instead ofUnimplementedError. Only authentication,isSignedIn,getCurrentPlayerandeventsstill throwUnimplementedError, because every provider must supply them. Update anycatch (UnimplementedError)in provider tests. - Lobbies: new models
Lobby,LobbyMember,LobbyVisibility,LobbyFilter,LobbyFilterOp;Lobby.memberCount/sizefor providers that only return a search summary; platform methodscreateLobby,joinLobby,leaveLobby,getLobby,findLobbies,updateLobby,setMemberData; eventsLobbyMemberJoinedEvent,LobbyMemberLeftEvent,LobbyDataChangedEvent,LobbyOwnerChangedEvent,LobbyClosedEvent(sealedLobbyEvent) andJoinRequestedEvent.RichPresencegainedpartyIdandjoinToken. Breaking:sendInvitation(lobbyId, userId)andInvitationReceivedEvent(senderId, joinToken, providerId). LobbyKind(lobbyorparty) andLobby.kind;createLobby(kind:). Providers persist it under the reserved lobby-data keylobbyKindDataKey(ugs_kind) and strip it on read; custom providers that store lobby data should do the same.getIdentityToken()is documented as gated byGameCapability.identityTokens(Steam: hex ticket, Epic: JWT).- New Tables: Added
UnifiedIdTable,UnifiedAchievementTable,UnifiedLeaderboardTable,UnifiedStatTable,ProviderId, andProviderIdMapfor central ID mapping resolution. - Added
statIds,resolveStatId(), andregisterMappings()toUnifiedGameServicesPlatform. - Added capability API to
UnifiedGameServicesPlatform(sendInvitation,createLobby,joinLobby,leaveLobby,startMatchmaking,cancelMatchmaking,showAchievementsUI,showLeaderboardsUI,showOverlay,getIdentityToken). - Added
InvitationReceivedEventto theGameServiceEventhierarchy. - Breaking:
dart_mappableremoved. Models and events are now hand-written immutable classes withcopyWith,==(deep for lists/maps),hashCodeandtoString. Gone:toJson/toMap/fromJson/fromMap, allXMapper,XMappable,XCopyWithandXValueCopytypes, and thetypediscriminator of events.copyWithkeeps the current value for anullargument (it cannot reset a field tonull). Nobuild_runnerneeded. PlayerProfile,Achievement,Stat,LeaderboardandCloudSaveMetadatagain an optionalproviderId(stamped by the facade; providers leave it null).
0.1.0 #
Initial release.
- Shared models (dart_mappable), sealed
GameServiceEventhierarchy,GameCapabilityset, normalizedGameServiceExceptiontypes and theUnifiedGameServicesPlatformbase contract every provider extends. - Unified-key → native-id aliasing for leaderboards and achievements
(
leaderboardIds/achievementIds). dispose()lifecycle hook (default no-op) so hosts can release provider resources through the unified API.