flutter_app_insights 0.0.1
flutter_app_insights: ^0.0.1 copied to clipboard
A library that helps your product connect to Microsoft AppInsights. Supports All Platforms
// example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_app_insights/flutter_app_insights.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
InsightsClient.instance.configure(
instrumentationKey: 'MY INSIGHTS KEY',
timerUploadInSeconds: 30,
countOfRecordsToUploadViaBatch: 10,
allowCrashReporting: true,
allowInternalLogging: true,
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext ctx) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('flutter_app_insights example')),
body: Center(
child: ElevatedButton(
onPressed: () {
InsightsClient.instance.writeTrace(
message: {'env': 'dev'},
eventName: 'Sample Event Name',
level: TraceSeverityLevel.Information,
);
},
child: const Text('Send trace'),
),
),
),
);
}
}