games_services 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 64
A Flutter plugin to support game center and google play games services.

Screenshot #

iOS #

Android #

Usage #

Sign in: #

To sign in the user. You need to call the sign in before
making any action (like sending a score or unlocking an achievement).
GamesServices.signIn();

Show achievements: #

To show the achievements screen.
GamesServices.showAchievements();

Show leaderboards: #

To show the leaderboards screen.
GamesServices.showLeaderboards(iOSLeaderboardID: 'ios_leaderboard_id');
Note: You need to pass the leaderboard id for iOS, for android it's not required.

Submit score: #

To submit a Score to specific leader board.
-The 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));

note: You need to pass the leaderboard id for iOS in case of iOS and the leaderboard id for android in case of android.

Unlock achievement: #

To unlock an Achievement.
The 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.

GamesServices.unlock(achievement: Achievement(androidID: 'android_id',
                                              iOSID: 'ios_id',
                                              percentComplete: 100)); 

Note: You need to pass the achievement id for iOS in case of iOS and the achievement id for android in case of android. the percentComplete is required in case of iOS but not android.

Installing #

Simply add the following line to your pubspec.yaml file:

dependencies:
  games_services: any       # <-- Add this line

0.1.1 #

example/README.md

games_services_example #

Demonstrates how to use the games_services plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  games_services: ^0.1.1

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:games_services/games_services.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
28
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/achievement.dart.

Run flutter format to format lib/achievement.dart.

Format lib/games_services.dart.

Run flutter format to format lib/games_services.dart.

Format lib/helpers.dart.

Run flutter format to format lib/helpers.dart.

Format lib/score.dart.

Run flutter format to format lib/score.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test