uptimemesh_flutter 1.2.2
uptimemesh_flutter: ^1.2.2 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
- User identification — associate sessions with your users via
identify() - 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,
// AdBlocker bypass: kendi proxy'nizi kullanmak için:
// ingestUrl: 'https://yourdomain.com/um-proxy',
),
);
| Option | Type | Default | Description |
|---|---|---|---|
ingestUrl |
String? |
https://ingest.uptimemesh.com |
Ingest endpoint (AdBlocker bypass için override) |
flushInterval |
Duration |
30 seconds |
Auto-flush interval |
maxQueueSize |
int |
50 |
Queue size for immediate flush |
debug |
bool |
false |
Print logs to console |
apiUrl |
String? |
— | Deprecated — ingestUrl kullanın |
UptimeMesh.identify(userId) #
Oturumu bir kullanıcıyla ilişkilendirir. Dashboard'da Oturumlar → Kullanıcı sütununda görünür.
// Giriş sonrası
final user = await authService.login(email, password);
UptimeMesh.identify(user.id); // ID, e-posta veya kullanıcı adı
// Çıkış sonrası
await authService.logout();
UptimeMesh.identify(null);
identify()çağrılmadan oluşan oturumlar dashboardda—gösterir.
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.trackClick(elementName, {screen?}) #
Buton veya element tıklamalarını loglar. trackEvent('click', ...) için kısayol.
UptimeMesh.trackClick('checkout_button', screen: 'CartScreen');
UptimeMesh.trackClick('menu_item_profile');
Dashboard'da Events → click event'i olarak görünür. element ve screen alanları filtrelenebilir.
UptimeMesh.trackEvent(name, properties?) #
Track custom events.
UptimeMesh.trackEvent('purchase_completed', {
'amount': 99.90,
'currency': 'TRY',
'product_id': 'plan_pro',
});
İpucu: Dashboard'daki Events → Arama panelinden
event_name=purchase_completed,amount__gt:50gibi filtreler uygulayabilirsiniz.
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.2.2 #
UptimeMesh.trackClick(elementName, {screen?})— click event kısayoluUptimeMeshOptions.ingestUrl— AdBlocker bypass için özel endpoint- Varsayılan endpoint
ingest.uptimemesh.comolarak değiştirildi apiUrldeprecated edildi
1.2.0 #
identify(userId)— oturumu kullanıcıyla ilişkilendirSessionData.userIdalanı eklendi
1.1.1 #
UptimeMesh.trackNetwork()— Dio için manuel ağ event'isanitizeUrl()public edildi
1.0.0 #
- Initial release
License #
MIT © UptimeMesh