SankofaCatch class
Sankofa Catch — error tracking for Flutter. Construct once after
Sankofa.instance.init():
await Sankofa.instance.init(apiKey: 'sk_live_...');
final catcher = SankofaCatch(
environment: 'live',
readFlagSnapshot: () => switches.getAllKeys().asMap().map(...),
);
try { doThing(); } catch (e, st) { catcher.captureException(e, st); }
Uncaught Dart exceptions and async errors are captured
automatically via FlutterError.onError and
PlatformDispatcher.instance.onError. The instance self-registers
with the Traffic Cop; handshake payloads flow in automatically.
Constructors
Properties
- appVersion → String?
-
final
- beforeSend → BeforeSendFn?
-
Synchronous hook fired AFTER event composition but BEFORE the
transport enqueues. Return
nullto drop, return the (possibly modified) event to ship. Throws are swallowed — a host hook can never block the capture pipeline.final - environment → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → SankofaModuleName
-
no setter
-
readConfigSnapshot
→ Map<
String, dynamic> Function()? -
Same as readFlagSnapshot but for SankofaConfig remote values.
final
-
readFlagSnapshot
→ Map<
String, String> Function()? -
When non-null, called at every capture to read the active feature-
flag decisions. When null (the default after Phase A), Catch
auto-discovers the registered SankofaSwitch from the module
registry and reads its decisions directly — no boilerplate.
final
- release → String?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addBreadcrumb(
CatchBreadcrumb crumb) → void -
applyHandshake(
Map< String, dynamic> config) → Future<void> -
Called by the Core when the handshake response says this module is
enabled. The module starts its work (e.g. Deploy kicks off an
update check). If
enabled: false, this is NOT called — the module stays dormant. -
captureException(
Object error, [Object? stackTrace, CatchCaptureOptions? options]) → String -
captureMessage(
String message, [CatchCaptureOptions? options]) → String -
checkIntegration(
) → Future< ModuleIntegrationStatus> - Self-audit the host's Catch integration. Mirrors Deploy's audit shape so the reverse-handshake reporter can batch every module into one POST.
-
flush(
) → Future< void> - Flush pending events to the server. No-op if empty.
-
log(
String message, {String? category}) → void - Crashlytics-style structured log.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setExtra(
String key, dynamic value) → void -
setTag(
String key, String value) → void -
setTags(
Map< String, String> tags) → void -
setUser(
CatchUserContext? user) → void -
shutdown(
) → void - Teardown — uninstalls error handlers, cancels the flush timer. Useful for hot-reload dev loops; not required in production.
-
toString(
) → String -
A string representation of this object.
inherited
-
withScope<
T> (T fn(SankofaCatchScope scope)) → T -
Run
fnwith a fresh scope. Mutations made via the scope (tags, extras, user, level, fingerprint) overlay onto any captureException / captureMessage calls insidefn. The scope is popped whenfnreturns — async captures deferred past the closure's return will NOT see the scope.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → SankofaCatch?
-
no setter