ios_game_center 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new66

ios_game_center #

Flutter wrapper for the iOS Game Center: GameKit. There is an excellent wrapper for Android : which is well maintained. I designed the API for this plugin to resemble the API of that plugin.

Part 1: Sign In #

The sign in is a method, and the return is an object that contains a success boolean and player data if successful. The return is a Future.

final SignInResult _connect = await IOSGameCenter.signIn;
if ( _connect.success) {
    this.account = result.account;
} else {
    this.error = result.message;
this.loading = false;

Note : Sometimes Game Center will hang and seem to connect, but a connection will fail (you get the GameCenter welcome banner, but the app won't be connected). I believe this is an issue more for developers who test on their phone's and are switching between accounts. If this happens then close the app. Logout and in of GameCenter directly then try the app again.

The Game Center Sign In will prompt on any app, but to actually connect you should add the GameCenter Service to your app via xCode.

Score Functions. You'll need to go to the App Store Connect (, Then select your app, then select Features, then Game Center, and there you add achievements and leaderboards.

Part 2: Leaderboard #

Show leaderboard: For iOS you need to display a specific leaderboard to open the GameCenter Leaderboard lists. So pass in the leaderboard id (String). It is recommended you do the ids as bundles. The bundle should match you app id bundle. Return a success boolean as a Future.


Posting a score: To submit you'll need to pass an id (String), and a score (int). Return a success boolean as a Future.

IOSGameCenter.submitScore(id:'games.mydomain.gamename.leaderboard_id', score: 200)

Part 2: Achievements #

Show Achievements: Opening the Achievements list is a straight method call and return a Future boolean:


Post Achievements: To post achievements you need to send an achievement id (String), again it should be a bundle id. The unlockAchievement complete the achievement and setPercentAchievement will set the current percentage as percent (double). So you need to track the achievement progress in your code. This returns a Future boolean:


IOSGameCenter.setPercentAchievement(id: 'games.mydomain.gamename.achievement_id', percent: percent);

Part 3: Future Development #

Retrieve score data for both leaderboards and achievements. Get Image data for users. Pulls and collaborations welcome.

0.0.1 #

  • Initial connection for iOS -- test successful

0.0.2 #

  • Add map for SignIn

0.0.3 #

  • Tweak map for SignIn

0.0.4 #

  • Bug Fix

0.0.5 #

  • Add core displays and reporting scores for leaderboards and achievements

0.0.6 #

  • Swift code fix

0.0.7 #

  • Complete Swift code fix

0.0.8 #

  • Complete updates for workable version

0.0.9 #

  • Bug fix

0.0.10 #

  • Bug fix

0.0.11 #

  • Bug fix

0.1.0 #

  • All Methods tested ready for use.

0.1.1 #

  • Update documentation

0.1.2 #

  • Update documentation


import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:ios_game_center/ios_game_center.dart';

void main() {

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  SignInResult _results;

  void initState() {

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> signIn() async {
    SignInResult results;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      results = await IOSGameCenter.signIn;
    } on PlatformException {
      results = null;
    if (!mounted) return;

    setState(() {
      _results = results;

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        body: Center(
          child: Text('Sign On: ${_results!=null? _results.toString():'not connected'}'),


Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  ios_game_center: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:ios_game_center/ios_game_center.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:ios_game_center/ios_game_center.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:ios_game_center/ios_game_center.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:ios_game_center/ios_game_center.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:ios_game_center/ios_game_center.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [ios_game_center] that is in a package requiring null.

Health suggestions

Format lib/ios_game_center.dart.

Run flutter format to format lib/ios_game_center.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies