Flutter

Learn how to install the Sahha SDK in your Flutter project

Installation

Follow these steps to install the Sahha SDK in your Flutter project.


Step 1) Add Flutter Package Dependency

Add sahha_flutter as a dependency in your pubspec.yaml file.

dependencies:
    flutter:
        sdk: flutter

    sahha_flutter:
        git:
            url: git://github.com/sahha-ai/sahha_flutter.git

 

Step 2) Install Flutter Package

Run flutter pub get inside the root folder of your Flutter project.

$ flutter pub get

Android

Follow these additional steps to install the Sahha SDK in your Android project.


Step 1) Add Permissions

Add the required permissions to your project's AndroidManifest.xml.

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />

iOS

Follow these additional steps to install the Sahha SDK in your iOS project.


📘

Install CocoaPods

You will need to install CocoaPoads before you can install the Sahha SDK to your iOS project.

Visit cocoapods.org to learn how to install CocoaPods.

Step 1) Install Sahha Pod

Run pod install from the Terminal app in your project root folder.

$ pod install

Step 2) Project Settings

🚧

Setup Xcode

You will need to edit your Xcode project settings to enable the Sahha SDK.

Xcode Project Settings


Flutter Project

Step 1) Import Sahha Package

Import the sahha_flutter package into any files inside your Flutter project that use the SDK.

import 'package:sahha_flutter/sahha_flutter.dart';

What's next?