bugwatch_sdk 0.1.0
bugwatch_sdk: ^0.1.0 copied to clipboard
Official Dart/Flutter SDK for Bugwatch error tracking. Zero dependencies.
Bugwatch Dart SDK #
Official Dart/Flutter SDK for Bugwatch error tracking. Single dependency (http).
Install #
dependencies:
bugwatch_sdk:
git:
url: https://github.com/roomylabs/bugwatch-dart.git
ref: v0.1.0
Quick start (Flutter) #
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:bugwatch_sdk/bugwatch_sdk.dart';
void main() {
Bugwatch.init(
'https://bw-YOUR_KEY@bugwatch-api.loadmindx.com/api/22',
environment: 'production',
release: '1.0.0',
);
// Auto-capture all uncaught Flutter zone errors:
runZonedGuarded(() => runApp(MyApp()), Bugwatch.captureException);
}
Pure Dart #
Bugwatch.init('https://bw-YOUR_KEY@bugwatch-api.loadmindx.com/api/22');
try {
riskyOperation();
} catch (e, st) {
Bugwatch.captureException(e, st);
}
Bugwatch.captureMessage('Payment confirmed', level: 'info');
await Bugwatch.flush(); // wait for async sends (short-lived scripts)
API #
| Member | Description |
|---|---|
Bugwatch.init(dsn, environment:, release:, debug:, sendDefaultPii:, allowHttp:) |
Initialize (HTTPS enforced; allowHttp dev-only) |
Bugwatch.captureException(error, stackTrace, level:, tags:) |
Report an exception |
Bugwatch.captureMessage(message, level:, tags:) |
Report a message |
Bugwatch.setUser(map) / setTag(k, v) / setContext(map) |
Global scope |
Bugwatch.addBreadcrumb(msg, category:, level:, data:) |
Breadcrumb (capped at 100) |
Bugwatch.flush([timeout]) |
Wait for in-flight sends |
Behavior #
- Sends are async (max 50 in flight);
await Bugwatch.flush()in short-lived scripts - HTTPS enforced —
http://DSNs throw unlessallowHttp: true - PII stripped by default —
email/username/ip_addressremoved from user;Cookie/Authorizationheaders removed from request context - Failures never crash the host app (silent unless
debug: true) - DSN format:
https://<public_key>@<host>/api/<project_id>(project ingest key — Settings → API keys)