Skip to main content

Official Coralogix SDK for Flutter

The Coralogix RUM Mobile SDK is library (plugin) for Flutter The SDK provides mobile Telemetry instrumentation that captures:

  1. HTTP requests
  2. Unhandled / handled exceptions
  3. Custom Log
  4. Crashes (iOS Native - using PLCrashReporter)
  5. Views
  6. Session Replay (record and replay user sessions)

Coralogix captures data by using an SDK within your application's runtime. These are platform-specific and allow Coralogix to have a deep understanding of how your application works.

Requirements​

The plugin requires Flutter 3.27.0 or above.

That is the constraint to check. pubspec.yaml also declares a Dart range of >=3.4.1 <4.0.0, but Dart ships inside Flutter, and the Dart bundled with 3.27.0 is already well above that floor - so satisfying the Flutter requirement satisfies the Dart one, and no supported setup sits between them. The upper bound still matters: the plugin does not claim Dart 4 support.

Installation​

Step 1 :Add Coralogix dependency​

In the root folder of your flutter app add the Coralogix package: flutter pub add cx_flutter_plugin.

Step 2 :Integration​

To initialize the RUM SDK, supply both CXExporterOptions and CXDomain.

import 'package:cx_flutter_plugin/cx_http_client.dart';

class _MyAppState extends State<MyApp> {

void initState() {
super.initState();
initPlatformState();
}

Future<void> initPlatformState() async {
var coralogixDomain = **< Coralogix Domain >**;

var options = CXExporterOptions(
coralogixDomain: <CXDomain>,
userContext: null,
environment: '<Environment>',
application: '<App Name>',
version: '<App Version>',
publicKey: '<PublicKey>',
ignoreUrls: [],
ignoreErrors: [],
customDomainUrl: '',
labels: {'item': 'playstation 5', 'itemPrice': 1999},
debug: false,
);

await CxFlutterPlugin.initSdk(options);

// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
}

Step 3: Android setup​

Add the INTERNET permission to your app's main Android manifest:

<!-- android/app/src/main/AndroidManifest.xml -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<!-- ...your <application> block... -->
</manifest>

Why this matters. New Flutter projects ship with INTERNET declared only in the debug/ and profile/ manifest variants (for hot-reload). Release builds inherit only from main/, so without this entry your release app has no network access at all — the Coralogix RUM SDK silently can't reach the ingest endpoint, and Image.network / HTTP calls fail. iOS has no equivalent permission gate, which is why this only bites on Android release builds.

If you're on targetSdk 28+, also make sure any cleartext HTTP endpoints you call are allowed via android:usesCleartextTraffic or a network-security-config.xml. HTTPS endpoints (including all Coralogix ingest domains) work without extra config.

Step 4: iOS setup​

No extra steps. Flutter adds the Coralogix iOS SDK through Swift Package Manager (default from Flutter 3.44; plugin 0.18.0 and later) or CocoaPods, depending on your project configuration.

Note

On Flutter 3.44 to 3.48, Swift Package Manager can fail to resolve the plugin when you install it as a git dependency. Install it from pub.dev instead.

Last updated on
On this page
Was this page helpful?