uptimemesh_flutter 1.0.0
uptimemesh_flutter: ^1.0.0 copied to clipboard
UptimeMesh Flutter SDK — crash, performance and network monitoring.
uptimemesh_flutter #
Flutter SDK for UptimeMesh — automatic crash reporting, session tracking, screen analytics and custom event monitoring.
Features #
- Automatic crash reporting —
FlutterError.onError+PlatformDispatcher.onError - Session tracking — device model, OS, app version, network type
- Screen tracking — automatic via
NavigatorObserver - Custom events — track any user action with properties
- Offline buffer —
SharedPreferencespersistence, auto-retry on reconnect - Batch sending — efficient 30s batching
- Null-safe — Dart 3 / Flutter 3+
Installation #
Add to pubspec.yaml:
dependencies:
uptimemesh_flutter: ^1.0.0
Then:
flutter pub get
Quick Start #
// main.dart
import 'package:flutter/material.dart';
import 'package:uptimemesh_flutter/uptimemesh_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await UptimeMesh.init('YOUR_API_KEY');
runApp(const MyApp());
}
Get your API key from UptimeMesh dashboard → Mobil Uygulamalar → [App] → Entegrasyon.
API Reference #
await UptimeMesh.init(apiKey, [options]) #
Initialize the SDK. Must be called after WidgetsFlutterBinding.ensureInitialized().
await UptimeMesh.init(
'YOUR_API_KEY',
const UptimeMeshOptions(
debug: true,
flushInterval: Duration(seconds: 30),
maxQueueSize: 50,
apiUrl: 'https://api.uptimemesh.com', // on-prem override
),
);
| Option | Type | Default | Description |
|---|---|---|---|
apiUrl |
String? |
https://api.uptimemesh.com |
API endpoint |
flushInterval |
Duration |
30 seconds |
Auto-flush interval |
maxQueueSize |
int |
50 |
Queue size for immediate flush |
debug |
bool |
false |
Print logs to console |
Automatic Screen Tracking #
Add UptimeMesh.navigatorObserver to MaterialApp:
MaterialApp(
navigatorObservers: [UptimeMesh.navigatorObserver],
routes: {
'/': (_) => const HomeScreen(),
'/profile': (_) => const ProfileScreen(),
},
)
For GoRouter:
GoRouter(
observers: [UptimeMesh.navigatorObserver],
routes: [ /* ... */ ],
)
UptimeMesh.trackScreen(name) #
Manual screen tracking.
UptimeMesh.trackScreen('HomeScreen');
UptimeMesh.trackEvent(name, properties?) #
Track custom events.
UptimeMesh.trackEvent('button_tapped', {'button': 'login'});
UptimeMesh.trackEvent('purchase_completed', {
'amount': 99.90,
'currency': 'TRY',
'product_id': 'plan_pro',
});
UptimeMesh.captureError(error, stackTrace?) #
Manually report a caught error.
try {
await loadData();
} catch (e, stack) {
UptimeMesh.captureError(e, stack);
}
await UptimeMesh.flush() #
Immediately send all queued events.
await UptimeMesh.flush();
Error Boundary (Recommended) #
Wrap your app with a runZonedGuarded to catch async errors outside the Flutter framework:
void main() {
runZonedGuarded(() async {
WidgetsFlutterBinding.ensureInitialized();
await UptimeMesh.init('YOUR_API_KEY');
runApp(const MyApp());
}, (error, stack) {
UptimeMesh.captureError(error, stack);
});
}
What's Collected Automatically #
| Data | Source |
|---|---|
| Flutter framework errors | FlutterError.onError |
| Dart async / platform errors | PlatformDispatcher.onError |
| Device model | device_info_plus |
| OS version | device_info_plus |
| App version + build number | package_info_plus |
| Network type (wifi/cellular) | connectivity_plus |
Event Types #
| Type | Description | Triggered By |
|---|---|---|
crash |
Unhandled fatal error | Framework hooks |
error |
Caught / non-fatal error | captureError() |
screen |
Screen view | navigatorObserver / trackScreen() |
event |
Custom user action | trackEvent() |
Offline Mode #
Events are persisted to SharedPreferences when offline. On the next app launch, they are loaded and sent automatically.
Troubleshooting #
Events not showing up?
- Enable
debug: true— look for[UptimeMesh]prints - Check your API key in the dashboard
- Call
await UptimeMesh.flush()manually to force send
init() throws?
- Make sure
WidgetsFlutterBinding.ensureInitialized()is called beforeinit()
Screen tracking not working?
- Ensure
UptimeMesh.navigatorObserveris innavigatorObserverslist - Named routes must be set — unnamed routes have no
route.settings.name
Changelog #
1.0.0 — 2026-06-22 #
- Initial release
- Crash reporting via
FlutterError.onError+PlatformDispatcher.onError navigatorObserverfor automatic screen trackingtrackEvent,trackScreen,captureError,flushdevice_info_plus,package_info_plus,connectivity_plusintegrationSharedPreferencesoffline buffer- Batch sending with 30s interval
License #
MIT © UptimeMesh