Getting Started

Install the Gameball Flutter SDK into your app

The Gameball SDK for Flutter enables you to use the show Gameball customer profile in your app, track app customer events, and integrate referrals.

Installation

Follow the below steps to start installing Flutter SDK package to your app

  • Install package using flutter

 $ flutter pub add gameball_sdk

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  gameball_sdk: ^1.0.2

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

Make sure that you added the INTERNET permission in your application's AndroidManifest.xml and info.plist files

To install Firebase Google Play Services dependencies

Firebase is an integral dependency to the sdk, you'll have to include the following dependencies in your project's pubspec.yaml file

 $ flutter pub add firebase_core
 $ flutter pub add firebase_dynamic_links
 $ flutter pub add firebase_messaging

Then run the flutter pub get command.

Import it

It is also required to have a Firebase project configured and linked to your project, follow this tutorial on how to integrate with Firebase.

Now in your Dart code, you can use:

import 'package:gameball/gameball_sdk.dart';

Initialization

To create a GameballApp instance you need to call the getInstance method.

  GameballApp gameballApp = GameballApp.getInstance();

Note that you need to have an initialized Firebase App to be able to the use the Referral and Notifications features.

Make sure that you call the following code after connecting with your Firebase project.

await Firebase
    .initializeApp(options: DefaultFirebaseOptions.currentPlatform)
    .then((response){});

Initialize GameballApp Instance

To initialize GameballApp instance in your application class, use the init method which takes the following parameters (replace the braces with your values)

// Using the Gameball instance created
gameballApp.init("{api_key}", "{lang}", "{platform}", "{shop}");

Widget Parameters Description

APIKey string Required

The unique identifier for the player whose attributes are being updated.


lang string Optional

The unique identifier for the player whose attributes are being updated.


shop string Optional Shopify Only

Store name with myshopify.com domain. Used if your app is a mobile app for a Shopify store connected to Gameball


platform string Optional

The platform you application used:

  • Shopify

  • Salla

  • any

Profile Languages

For websites with multiple languages, how you can change Gameball widget language based on active website language. Gameball supports multiple languages for the customer profile widget. The widget language can be changed based on your customer's active language on the website.

Learn how you can configure the languages on your Gameball account through this article.

Supported Languages & Codes

  • English: en

  • Arabic: ar

  • French: fr

  • Spanish: es

  • German: de

  • Portuguese: pt

  • Polish: pl

  • Italian: it

  • Hungarian: hu

  • Chinese (Traditional, Taiwan): zh-tw

  • Dutch: nl

  • Swedish: sv

  • Norwegian: no

  • Danish: dk

  • Japanese: ja

In order to show the correct language of the widget based on the active language on the website, you just need to use the language code inside the lang variable in the code snippet.

Last updated