Skip to content

Flutter installation

  • Flutter 3.24 or later, Dart 3.5 or later
  • iOS 15 or later, Android minSdk 23 or higher
  • The team’s SDK key (rsk_…) from the form’s Share → Mobile app tab

The plugin supports iOS and Android. It contains the native SDK sources, so you add no native dependency yourself.

The package is responsly_sdk. It is not on pub.dev. Add it to pubspec.yaml from the source given in your access details. For a git source the entry looks like this, with <package URL> standing for the URL you received:

pubspec.yaml
dependencies:
responsly_sdk:
git:
url: <package URL>
ref: 1.34.0

Then run flutter pub get.

Raise the minimums if your project is below them.

ios/Podfile
platform :ios, '15.0'
android/app/build.gradle.kts
android {
defaultConfig {
minSdk = 23
}
}

The same lines work in a Groovy android/app/build.gradle.

Call initialize in main, before runApp.

lib/main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:responsly_sdk/responsly_sdk.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Responsly.initialize(
'rsk_…',
options: const ResponslyOptions(
logLevel: kDebugMode ? ResponslyLogLevel.debug : ResponslyLogLevel.error,
),
);
runApp(const MyApp());
}

Every method returns Future<void>. You do not have to await them: calls are applied in the order you make them, and calls made before initialize are remembered and applied when the SDK starts.

initialize is idempotent for the same key. Calling it with a different key resets the SDK’s local state first.

ResponslyOptions has two fields.

FieldValuesNotes
logLevelResponslyLogLevel.none, .error, .info, .debugUse debug while integrating. See Testing & debugging.
apiHostStringDefaults to https://api.responsly.com. Leave it unset unless Responsly support gives you another host.

The plugin adds ResponslyNavigatorObserver, which reports named routes as screens:

MaterialApp(
navigatorObservers: [ResponslyNavigatorObserver()],
// …
);

Details are in Track events & screens.