kubesense_flutter_plugin 1.0.0
kubesense_flutter_plugin: ^1.0.0 copied to clipboard
Flutter bindings and tools for utilizing Kubesense Mobile SDks
example/lib/main.dart
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-Present Datadog, Inc.
// Modifications copyright 2026 KubeSense Technologies.
import 'package:kubesense_flutter_plugin/kubesense_flutter_plugin.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'example_app.dart';
void main() async {
await dotenv.load();
var applicationId = dotenv.maybeGet('KUBESENSE_APPLICATION_ID');
final configuration = KubesenseConfiguration(
clientToken: dotenv.get('KUBESENSE_CLIENT_TOKEN', fallback: ''),
env: dotenv.get('KUBESENSE_ENV', fallback: ''),
service: 'ai.kubesense.example.flutter',
version: '1.2.3',
kubesenseRumEndpoint:
dotenv.get('KUBESENSE_RUM_ENDPOINT', fallback: 'us2.kubesense.ai'),
nativeCrashReportEnabled: true,
loggingConfiguration: KubesenseLoggingConfiguration(),
rumConfiguration: applicationId != null
? KubesenseRumConfiguration(
sessionSamplingRate: 100.0,
applicationId: applicationId,
detectLongTasks: true,
reportFlutterPerformance: true,
actionEventMapper: (event) {
if (event.action.target?.name == 'Test Action') {
event.action.target?.name = 'Replaced';
}
return event;
},
)
: null,
);
final ddsdk = KubesenseSdk.instance;
ddsdk.sdkVerbosity = CoreLoggerLevel.debug;
KubesenseSdk.runApp(configuration, TrackingConsent.granted, () async {
return runApp(const ExampleApp());
});
}