recco 0.0.2
recco: ^0.0.2 copied to clipboard
A Flutter plugin for both iOS and Android recco-sdk.
[recco_header]
Recco Flutter Plugin #
This repository holds the codebase for the Recco Flutter plugin. Instructions on how to add and use this plugin can be found in the Usage section.
Overview #
Personalized, and user-friendly approach to health and wellness recommendations based on users' unique interests, motivations, and health behaviors. Whether they are looking to improve their fitness, manage their stress, or simply lead a more fulfilling life. Recco is designed to help them reach their full potential.
Learn more about Recco SDK:
Usage #
Add this to pubspec.yaml
dependencies:
recco: 0.0.2
Initial setup on Android #
This Flutter plugin internally depends on the Recco Android SDK, which exposes its components through Github Packages. Therefore, the configuration for Github Packages is required. Please refer to the Personal Access Token section to obtain a valid set of credentials. Once you have a valid Github PAT, proceed to configure your gradle.properties file located under the ~/.gradle/ folder.
gprUser=your-github-user-here
gprKey=your-github-PAT-here
Recco Android SDK depends internally on Hilt. If your Android app does not use Hilt already, you will have to add this setup:
Add Hilt dependency to your app build.gradle:
implementation "com.google.dagger:hilt-android:2.47"
kapt "com.google.dagger:hilt-android-compiler:2.47"
Then decorate your Application class with the @HiltAndroidApp annotation:
@HiltAndroidApp
class ShowcaseApp : FlutterApplication() {
}
You can check the example app inside this repo for more details.
ReccoPlugin new Instance #
final Recco _reccoPlugin = Recco();
Init #
Initialize Recco SDK at the initState of your app.
Future<void> _initializeRecco(String clientSecret) async {
try {
_reccoPlugin.initialize(clientSecret, ReccoStyle.spring());
} on PlatformException catch (e) {
debugPrint("Error: '${e.message}'.");
}
}
Login #
Future<String> _loginReccoSDK(String userId) async {
try {
_reccoPlugin.login(userId);
} on PlatformException catch (e) {
debugPrint("Error: '${e.message}'.");
}
return userId;
}
Logout #
Future<void> _logoutReccoSDK() async {
try {
_reccoPlugin.logout();
} on PlatformException catch (e) {
debugPrint("Error: '${e.message}'.");
}
}
OpenReccoUi #
Future<void> _openReccoUI() async {
try {
_reccoPlugin.openReccoUI();
} on PlatformException catch (e) {
debugPrint("Error: '${e.message}'.");
}
}