Crash reporting
A patch doesn't change your app's version number, so a crash report alone can't tell you whether it came from the store build or patch 4. Add OverPush's tags to your crash reporter and every report names the exact code that was running.
The tags
OverPush.crashTags() returns two tags:
| Tag | Example | Meaning |
|---|---|---|
overpush_release | 1.3.1-3c2cf56298 | The release the store build was made from |
overpush_patch | 4 or none | The patch running in this launch, or none for the store build |
Set them once, early in your app's start, after your crash reporter is initialized. A patch downloaded during a session only runs from the next start, so the tags stay correct for the whole session.
import 'package:overpush/overpush.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Future<void> tagCrashReports() async {
final tags = await OverPush.crashTags();
Sentry.configureScope((scope) {
tags.forEach(scope.setTag);
});
}
In Sentry you can then filter issues by overpush_patch, or compare a patch against the store build.
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:overpush/overpush.dart';
Future<void> tagCrashReports() async {
final tags = await OverPush.crashTags();
for (final entry in tags.entries) {
await FirebaseCrashlytics.instance.setCustomKey(entry.key, entry.value);
}
}
The keys show under Keys on every crash in the Firebase console, and you can search by them.
final tags = await OverPush.crashTags();
// {overpush_release: 1.3.1-3c2cf56298, overpush_patch: 4}
// Pass them to your reporter's "tags", "custom keys" or "context".
Call tagCrashReports() from a place that runs once per start, for example your first screen's initState.
Want just the number?
final int? patch = await OverPush.currentPatchNumber(); // null = the store build
OverPush's own crash protection
You don't need a crash reporter for safety: if a patch breaks your app's start, the device drops it by itself and the console shows why. A crash reporter covers the rest, such as a bug three screens in. See Automatic rollback.