Skip to main content

unified_game_services_platform_interface 0.2.0 copy "unified_game_services_platform_interface: ^0.2.0" to clipboard
unified_game_services_platform_interface: ^0.2.0 copied to clipboard

Shared platform interface for unified_game_services — models, events, capabilities and the base contract every provider implements (pure Dart).

example/unified_game_services_platform_interface_example.dart

import 'package:unified_game_services_platform_interface/unified_game_services_platform_interface.dart';

/// Demonstrates the unified models and capability gating.
///
/// Apps and federated providers depend on this package only for the shared
/// API; concrete providers (Google Play, Game Center, Steam, Epic, Xbox PC,
/// GameJolt) implement [UnifiedGameServicesPlatform].
void main() {
  final platform = _ExampleProvider();

  if (platform.supports(GameCapability.achievements)) {
    platform.unlockAchievement('first_win');
  }

  // Models are immutable value objects: copyWith, ==, hashCode, toString.
  const profile = PlayerProfile(id: 'p1', displayName: 'Ada');
  final tagged = profile.copyWith(providerId: 'steam');
  print('same player: ${tagged.id == profile.id}, equal: ${tagged == profile}');
}

class _ExampleProvider extends UnifiedGameServicesPlatform {
  @override
  String get providerId => 'example';

  @override
  Set<GameCapability> get capabilities => const {GameCapability.achievements};

  @override
  Future<void> unlockAchievement(String achievementId) async {}
}
0
likes
160
points
92
downloads

Documentation

Documentation
API reference

Publisher

verified publisheraprimo.dev

Weekly Downloads

Shared platform interface for unified_game_services — models, events, capabilities and the base contract every provider implements (pure Dart).

Homepage
Repository (GitHub)
View/report issues

Topics

#game-services #achievements #leaderboards #platform-interface #gamedev

License

MIT (license)

Dependencies

plugin_platform_interface

More

Packages that depend on unified_game_services_platform_interface