Official Coralogix SDK for Flutter
The Coralogix RUM Mobile SDK is library (plugin) for Flutter The SDK provides mobile Telemetry instrumentation that captures:
- HTTP requests
- Unhandled / handled exceptions
- Custom Log
- Crashes (iOS Native - using PLCrashReporter)
- Views
- 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.
Installaion
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
Inorder to initailized the RUM SDK, please 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.