Challenges Plugin
note
Ensure the basic integration of the Nudge Core SDK is complete. If not, check here.
Overview
The nudge_challenges_v2
package lets you add challenges to your flutter application.
Find the latest version of nudge_challenges_v2
here
Step 1: Installation
Add nudge_challenges_v2
to your pubspec.yaml
file:
dependencies:
nudge_challenges_v2: ^latest_version
Run the following command to fetch the package:
flutter pub get
Step 2: Initialization
Import the NudgeChallengesUi()
class from nudge_flutter_challenges_v2.dart
import 'package:nudge_challenges_v2/nudge_flutter_challenges_v2.dart';
Create an instance of NudgeChallengesUi
var challengesUi = NudgeChallengesUi();
Add this instance to the plugins
list in the NudgeProvider
:
return NudgeProvider(
nudgeInstance: core,
plugins : [challengesUi]
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 Challenges defined on your Dashboard using the challengesUi
plugin.