Skip to main content

Add Kettle

Preqrequisites

The following criterias must be fulfilled to implement the SDK:

  • Minimum iOS target: 11.0
  • Minimum Android minSdk: 15
  • Minimum Android compileSdk: 31
  • Minimum Kotlin version: 1.8.10

Add dependency

The plugin is available at pub.dev. Add the following package to your pubspec:

pubspec.yaml
dependencies:
kettle: ^x.x.x

Install flutter package

Install the package.

$ flutter pub get

Android

IMPORTANT

A runtime exception will be thrown on launch if API key is missing.

In AndroidManifest.xml, add the following element as a child of the application element:

AndroidManifest.xml
<meta-data
android:name="com.kogenta.kettle.sdk.API_KEY"
android:value="<API-KEY>"
/>

If your project utilizees ProGuard for obfuscation and code minification, add the following exception to your definition:

-keepclassmembers class com.kogenta.kettle.core.model.** { *; }

iOS

After running flutter pub get, navigate to your projects ios directory and install hte pods imported by the kettle plugin. Open the runner workspace afterwards.

$ cd ios
$ pod install
$ open Runner.xcworkspace

In your AppDelegate didFinishLaunchingWithOptions, add the following to initialize Kettle:

AppDelegate.swift
import KettleKit
...
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...

let kettleConfig = KettleConfig.default()
kettleConfig.developmentApiKey = "<DEV-API-KEY">
kettleConfig.productionApiKey = "<PROD-API-KEY">

// optionally, override Kettle's default log verbosity
kettleConfig.productionLogLevel = .none
kettleConfig.developmentLogLevel = .debug

// Initialize Kettle
Kettle.prepare(config, launchOptions: launchOptions)

...
}

Add bluetooth-central to your applications background modes. This is required to scan for eddystone data. Add the required permissions to your Info.plist.

Import Kettle in Dart

You can import Kettle in Dart as:

import 'package:kettle/kettle.dart';