Flutter agent

Prerequisites

Following are the prerequisites required for installing Flutter.

  • Flutter SDK >=2.12.0 <3.0.0

Android

  • Android 5.0 or higher - min SDK 21
  • Android Gradle Plugin - 4.2.0+
  • Gradle version - 6.7.1+

iOS

  • Mac OS 10.15.7 and above
  • iOS 12 and above
  • Download Install X-Code 12.2 and above
  • Install cocoa pods in the system

Adding SixthSense Flutter dependency

Add Flutter dependency for both iOS and Android using the following procedure.

  1. In your application's pubspec.yaml file, add the following under dependencies and run the pub get command.
sixthsense:
url: https://Flutter-Monitoring:<git-lab-access-token>@artifacts-observability.sixthsense.rakuten.com/sixthsense/sixthsense-mobile-monitoring-flutter.git
ref: develop
path: sixthsense

GitLab acess token will be shared by Rakuten's customer support team at the time of onboarding.

  1. Make the following changes in your main.dart file.
import 'package:sixthsense/sixthsense.dart';
void main() {
runZonedGuarded<Future<void>>() async {
WidgetsFlutterBinding.ensureInitialized();
await sixthsense.initialize();
runApp(const YourApp());
}, (error, stack) {
sixthsense.reportError(error, stack);
exit(1);
}};
  1. To report handled errors, use the following method in catch blocks from .dart files after importing sixthsense.
import 'package:sixthsense/sixthsense.dart';
try {
throw StateError('try catch');
} catch (e, stack) {
sixthsense.reportHandledError(e, stack);
}

Configuring for Android

You can configure the agent using the AndroidManifest.xml file.

  1. Configure the Access Token in the application tag.
<meta-data android:name="com.rakuten.sixthsense.ACCESS_TOKEN" android:value="access-token-here" />

You can find the Access Token from the SixthSense dashboard. (Settings → General → Access token)

  1. Similarly, configure the reporting Base URL
<meta-data android:name= "com.rakuten.sixthsense.BASE_URL"
android:value="https://http-collector-observability.sixthsense.rakuten.com/poc-mobile"/>

Apply the plugin in the module level build.gradle.

apply plugin: "SSNetworkPlugin"

Following are the requirements for the above Http client's auto instrumentation.

  • Android Gradle Plugin - 7.1+
  • Gradle version - 7.2+

Configuring for iOS

You can configure the agent for iOS using the following procedure.

  1. Open xcworkspace file in X-Code.
  2. Open the Info.plist file and add "AccessToken" key as a string.
  3. Add value for the same.
  4. Open the Info.plist file.
  5. Add "EndPointName" key as a string.
  6. Add the value "https://http-collector-observability.sixthsense.rakuten.com/poc-mobile/" (for OneCloud Platform, use Add the value "https://sixthsense-backend.jpe2-caas1-prod1.caas.jpe2b.r-local.net/mobile".)