API Reference
Core SDK methods across all supported platforms.
Kotlin / Android SDK
AndroidiOSDesktop
Initialization
| Method | Description |
|---|---|
Snapbug.initialize(context) | Initialize the SDK with an Android Context |
Snapbug.initialize() | Initialize the SDK for Desktop or iOS |
Analytics
val analytics = snapbugAnalytics("user_events")
analytics.log("button_clicked", mapOf("screen" to "home"))| Method | Description |
|---|---|
snapbugAnalytics(id) | Get an analytics logger by table ID |
Dashboards
snapbugDashboard("app_metrics") {
// define dashboard widgets
}| Method | Description |
|---|---|
snapbugDashboard(id) { } | Define a custom dashboard with widgets |
Deep Links
snapbugDeeplink {
// configure deep link handlers
}| Method | Description |
|---|---|
snapbugDeeplink { } | Configure deep link handling for the Desktop inspector |
Tables
val table = snapbugTable("request_log")
table.addRow(mapOf("endpoint" to "/api/users", "status" to "200"))| Method | Description |
|---|---|
snapbugTable(name) | Get a table logger for custom tabular data |
Database
| Method | Description |
|---|---|
snapbugRegisterDatabase(...) | Register a local database for inspection |
snapbugLogDatabaseQuery(...) | Log a database query for the Desktop query viewer |
Preferences
| Method | Description |
|---|---|
snapbugRegisterPreference(...) | Register a SharedPreferences or DataStore instance |
WebSocket
| Method | Description |
|---|---|
snapbugLogWebSocketEvent(...) | Log a WebSocket event (send, receive, connect, disconnect) |
Flutter SDK
Flutter
Initialization
Snapbug.start(plugins: [
SnapbugCrashReporter(catchFatalErrors: true),
SnapbugNetwork(),
]);| Method | Description |
|---|---|
Snapbug.start(plugins: [...]) | Initialize the SDK with a list of plugins |
Snapbug.updateServerHost(host) | Change the Desktop app host address |
Analytics
final analytics = Snapbug.analytics("user_events");
analytics.log("button_clicked", {"screen": "home"});| Method | Description |
|---|---|
Snapbug.analytics(tableId) | Get an analytics logger by table ID |
Plugins
| Method | Description |
|---|---|
Snapbug.getPlugin<T>() | Get a registered plugin instance by type |
Network Interceptor
final dio = Dio();
dio.interceptors.add(SnapbugDioInterceptor());| Method | Description |
|---|---|
SnapbugDioInterceptor() | Dio HTTP interceptor for capturing network traffic |
React Native SDK
React Native
Initialization
import { Snapbug, SnapbugNetwork, SnapbugCrashReporter } from 'snapbug-react-native';
Snapbug.start({
plugins: [
new SnapbugNetwork(),
new SnapbugCrashReporter({ catchFatalErrors: true }),
],
});| Method | Description |
|---|---|
Snapbug.start(config) | Initialize the SDK with plugins and configuration |
Snapbug.stop() | Stop the SDK and disconnect from Desktop |
Analytics
const analytics = Snapbug.analytics("user_events");
analytics.log("button_clicked", { screen: "home" });| Method | Description |
|---|---|
Snapbug.analytics(tableId) | Get an analytics logger by table ID |
Plugins
| Method | Description |
|---|---|
Snapbug.getPlugin(Class) | Get a registered plugin instance by class |
Fetch Interception
Automatically intercept all fetch calls to capture network traffic:
import { patchFetch, unpatchFetch } from 'snapbug-react-native';
// Start intercepting
patchFetch();
// Stop intercepting
unpatchFetch();| Method | Description |
|---|---|
patchFetch() | Monkey-patch global fetch to auto-capture network calls |
unpatchFetch() | Restore the original fetch function |