Skip to main content
Version: 1.0.0

Leaderboard Plugin

note

Ensure the basic integration of the Nudge Core SDK is complete. If not, check here.

Overview

The nudge_leaderboard_v2 package lets you add leaderboards to your flutter application.

Find the latest version of nudge_leaderboard_v2 here

Step 1 : Installation

Add nudge_leaderboard_v2 to your pubspec.yaml file:

dependencies:
nudge_leaderboard_v2: ^latest_version

Run the following command to fetch the package:

flutter pub get

Step 2: Initialization

Import the NudgeLeaderboardUi() class from nudge_flutter_leaderboard_v2.dart

import 'package:nudge_leaderboard_v2/nudge_flutter_leaderboard_v2.dart';

Create an instance of NudgeLeaderboardUi

var leaderboardUi = NudgeLeaderboardUi();

Add this instance to the plugins list in the NudgeProvider:

return NudgeProvider(
nudgeInstance: core,
plugins : [leaderboardUi]
child: MaterialApp(
navigatorKey: NudgeProviderState.navigatorKey,
navigatorObservers : [_trackerObserver],
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Home(),
),
);

That's it!

Our Nudge Core would now trigger the leaderboard defined on your Dashboard using the leaderboardUi plugin.